|
|
@ -3,6 +3,7 @@ var path = require('path');
|
|
|
|
var fs = require('fs');
|
|
|
|
var fs = require('fs');
|
|
|
|
var file_path = path.normalize(__dirname + '/..') + '/RTL.conf';
|
|
|
|
var file_path = path.normalize(__dirname + '/..') + '/RTL.conf';
|
|
|
|
var logger = require('./logger');
|
|
|
|
var logger = require('./logger');
|
|
|
|
|
|
|
|
var common = require('../common');
|
|
|
|
|
|
|
|
|
|
|
|
exports.getRTLConfig = (req, res, next) => {
|
|
|
|
exports.getRTLConfig = (req, res, next) => {
|
|
|
|
logger.info('\r\nConf: 7: ' + JSON.stringify(Date.now()) + ': INFO: Getting RTL Config');
|
|
|
|
logger.info('\r\nConf: 7: ' + JSON.stringify(Date.now()) + ': INFO: Getting RTL Config');
|
|
|
@ -15,7 +16,12 @@ exports.getRTLConfig = (req, res, next) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const jsonConfig = ini.parse(data);
|
|
|
|
const jsonConfig = ini.parse(data);
|
|
|
|
res.status(200).json({settings: jsonConfig.Settings, nodeAuthType: (jsonConfig.Authentication.nodeAuthType) ? jsonConfig.Authentication.nodeAuthType : 'DEFAULT'});
|
|
|
|
authSettings = {
|
|
|
|
|
|
|
|
nodeAuthType: (jsonConfig.Authentication.nodeAuthType) ? jsonConfig.Authentication.nodeAuthType : 'DEFAULT',
|
|
|
|
|
|
|
|
lndConfigPath: (jsonConfig.Authentication.lndConfigPath) ? jsonConfig.Authentication.lndConfigPath : '',
|
|
|
|
|
|
|
|
bitcoindConfigPath: (jsonConfig.Authentication.bitcoindConfigPath) ? jsonConfig.Authentication.bitcoindConfigPath : ''
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
res.status(200).json({settings: jsonConfig.Settings, authSettings: authSettings});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -38,10 +44,26 @@ exports.updateUISettings = (req, res, next) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
exports.getLNDConfig = (req, res, next) => {
|
|
|
|
exports.getConfig = (req, res, next) => {
|
|
|
|
fs.readFile(req.headers.filepath, 'utf8', function(err, data) {
|
|
|
|
let confFilePath = '';
|
|
|
|
|
|
|
|
switch (req.params.nodeType) {
|
|
|
|
|
|
|
|
case 'lnd':
|
|
|
|
|
|
|
|
confFilePath = common.lnd_config_path
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'bitcoind':
|
|
|
|
|
|
|
|
confFilePath = common.bitcoind_config_path
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'rtl':
|
|
|
|
|
|
|
|
confFilePath = file_path;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
confFilePath = '';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info('\r\nConf: 43: ' + JSON.stringify(Date.now()) + ': INFO: Node Type: ' + req.params.nodeType + ', File Path: ' + confFilePath);
|
|
|
|
|
|
|
|
fs.readFile(confFilePath, 'utf8', function(err, data) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
logger.error('\r\nConf: 43: ' + JSON.stringify(Date.now()) + ': ERROR: Reading Conf Failed!');
|
|
|
|
logger.error('\r\nConf: 59: ' + JSON.stringify(Date.now()) + ': ERROR: Reading Conf Failed!');
|
|
|
|
res.status(500).json({
|
|
|
|
res.status(500).json({
|
|
|
|
message: "Reading Config File Failed!",
|
|
|
|
message: "Reading Config File Failed!",
|
|
|
|
error: err
|
|
|
|
error: err
|
|
|
|