Updates for docker enablement 3

pull/47/head
ShahanaFarooqui 5 years ago
parent cee08facff
commit 8ce930770a

@ -10,7 +10,7 @@ common.bitcoind_config_path = '';
common.enable_logging = false;
common.log_file = '';
common.rtl_sso = 0;
common.rtl_cookie_file = '';
common.rtl_cookie_path = '';
common.logout_redirect_link = '/login';
common.cookie = '';

@ -122,13 +122,13 @@ var setSSOParams = () => {
common.logout_redirect_link = process.env.LOGOUT_REDIRECT_LINK;
}
if(undefined !== process.env.RTL_COOKIE_FILE) {
common.rtl_cookie_file = process.env.RTL_COOKIE_FILE;
if(undefined !== process.env.RTL_COOKIE_PATH) {
common.rtl_cookie_path = process.env.RTL_COOKIE_PATH;
} else {
common.rtl_cookie_file = common.rtl_conf_file_path + '/cookies/auth.cookie';
common.rtl_cookie_path = common.rtl_conf_file_path + '/cookies/auth.cookie';
}
readCookie(common.rtl_cookie_file);
readCookie(common.rtl_cookie_path);
}
};
@ -188,8 +188,10 @@ var setOptions = () => {
var errMsg = '';
var configFileExists = () => {
common.rtl_conf_file_path = (undefined !== process.env.RTL_CONFIG_PATH) ? process.env.RTL_CONFIG_PATH : path.normalize(__dirname);
common.rtl_conf_file_path = (undefined !== process.env.RTL_CONFIG_PATH) ? process.env.RTL_CONFIG_PATH.substring(0, process.env.RTL_CONFIG_PATH.length - 9) : path.normalize(__dirname);
RTLConfFile = common.rtl_conf_file_path + '/RTL.conf';
console.log(common.rtl_conf_file_path);
console.log(RTLConfFile);
let exists = fs.existsSync(RTLConfFile);
if (exists) {
var config = ini.parse(fs.readFileSync(RTLConfFile, 'utf-8'));

@ -3,11 +3,11 @@ var path = require('path');
var fs = require('fs');
var logger = require('./logger');
var common = require('../common');
var RTLConfFilePath = common.rtl_conf_file_path + '/RTL.conf';
var RTLConfFile = common.rtl_conf_file_path + '/RTL.conf';
exports.getRTLConfig = (req, res, next) => {
logger.info('\r\nConf: 7: ' + JSON.stringify(Date.now()) + ': INFO: Getting RTL Config');
fs.readFile(RTLConfFilePath, 'utf8', function(err, data) {
fs.readFile(RTLConfFile, 'utf8', function(err, data) {
if (err) {
logger.error('\r\nConf: 10: ' + JSON.stringify(Date.now()) + ': ERROR: Getting RTL Config Failed!');
res.status(500).json({
@ -29,10 +29,10 @@ exports.getRTLConfig = (req, res, next) => {
};
exports.updateUISettings = (req, res, next) => {
var config = ini.parse(fs.readFileSync(RTLConfFilePath, 'utf-8'));
var config = ini.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
delete config.Settings;
fs.writeFileSync(RTLConfFilePath, ini.stringify(config));
fs.appendFile(RTLConfFilePath, ini.stringify(req.body.updatedSettings, { section: 'Settings' }), function(err) {
fs.writeFileSync(RTLConfFile, ini.stringify(config));
fs.appendFile(RTLConfFile, ini.stringify(req.body.updatedSettings, { section: 'Settings' }), function(err) {
if (err) {
logger.error('\r\nConf: 28: ' + JSON.stringify(Date.now()) + ': ERROR: Updating UI Settings Failed!');
res.status(500).json({
@ -47,23 +47,23 @@ exports.updateUISettings = (req, res, next) => {
};
exports.getConfig = (req, res, next) => {
let confFilePath = '';
let confFile = '';
switch (req.params.nodeType) {
case 'lnd':
confFilePath = common.lnd_config_path
confFile = common.lnd_config_path
break;
case 'bitcoind':
confFilePath = common.bitcoind_config_path
confFile = common.bitcoind_config_path
break;
case 'rtl':
confFilePath = RTLConfFilePath;
confFile = common.rtl_conf_file_path + '/RTL.conf';
break;
default:
confFilePath = '';
confFile = '';
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) {
logger.info('\r\nConf: 43: ' + JSON.stringify(Date.now()) + ': INFO: Node Type: ' + req.params.nodeType + ', File Path: ' + confFile);
fs.readFile(confFile, 'utf8', function(err, data) {
if (err) {
logger.error('\r\nConf: 59: ' + JSON.stringify(Date.now()) + ': ERROR: Reading Conf Failed!');
res.status(500).json({

Loading…
Cancel
Save