|
|
|
@ -12,6 +12,7 @@ var logger = require('./controllers/logger');
|
|
|
|
|
var connect = {};
|
|
|
|
|
var errMsg = '';
|
|
|
|
|
var request = require('request');
|
|
|
|
|
common.path_separator = (platform === 'win32') ? '\\' : '/';
|
|
|
|
|
|
|
|
|
|
connect.setDefaultConfig = () => {
|
|
|
|
|
var homeDir = os.userInfo().homedir;
|
|
|
|
@ -49,7 +50,7 @@ connect.setDefaultConfig = () => {
|
|
|
|
|
menuType: 'Regular',
|
|
|
|
|
theme: 'dark-blue',
|
|
|
|
|
satsToBTC: false,
|
|
|
|
|
channelBackupPath: homeDir + '/backup/node-0',
|
|
|
|
|
channelBackupPath: homeDir + common.path_separator + 'backup' + common.path_separator + 'node-0',
|
|
|
|
|
lndServerUrl: 'https://localhost:8080/v1',
|
|
|
|
|
enableLogging: false,
|
|
|
|
|
port: 3000
|
|
|
|
@ -179,14 +180,14 @@ connect.validateSingleNodeConfig = (config) => {
|
|
|
|
|
if(config.Settings.channelBackupPath !== '' && undefined !== config.Settings.channelBackupPath) {
|
|
|
|
|
common.nodes[0].channel_backup_path = config.Settings.channelBackupPath;
|
|
|
|
|
} else {
|
|
|
|
|
common.nodes[0].channel_backup_path = common.rtl_conf_file_path + '/backup';
|
|
|
|
|
common.nodes[0].channel_backup_path = common.rtl_conf_file_path + common.path_separator + 'backup';
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
connect.createDirectory(common.nodes[0].channel_backup_path);
|
|
|
|
|
let exists = fs.existsSync(common.nodes[0].channel_backup_path + '/channel-all.bak');
|
|
|
|
|
let exists = fs.existsSync(common.nodes[0].channel_backup_path + common.path_separator + 'channel-all.bak');
|
|
|
|
|
if (!exists) {
|
|
|
|
|
try {
|
|
|
|
|
var createStream = fs.createWriteStream(common.nodes[0].channel_backup_path + '/channel-all.bak');
|
|
|
|
|
var createStream = fs.createWriteStream(common.nodes[0].channel_backup_path + common.path_separator + 'channel-all.bak');
|
|
|
|
|
createStream.end();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Something went wrong while creating backup file: \n' + err);
|
|
|
|
@ -279,13 +280,13 @@ connect.validateMultiNodeConfig = (config) => {
|
|
|
|
|
common.nodes[idx].lnd_config_path = (undefined !== node.Authentication.lndConfigPath) ? node.Authentication.lndConfigPath : '';
|
|
|
|
|
common.nodes[idx].bitcoind_config_path = (undefined !== node.Settings.bitcoindConfigPath) ? node.Settings.bitcoindConfigPath : '';
|
|
|
|
|
common.nodes[idx].enable_logging = (undefined !== node.Settings.enableLogging) ? node.Settings.enableLogging : false;
|
|
|
|
|
common.nodes[idx].channel_backup_path = (undefined !== node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : common.rtl_conf_file_path + '/backup/node-' + node.index;
|
|
|
|
|
common.nodes[idx].channel_backup_path = (undefined !== node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : common.rtl_conf_file_path + common.path_separator + 'backup' + common.path_separator + 'node-' + node.index;
|
|
|
|
|
try {
|
|
|
|
|
connect.createDirectory(common.nodes[idx].channel_backup_path);
|
|
|
|
|
let exists = fs.existsSync(common.nodes[idx].channel_backup_path + '/channel-all.bak');
|
|
|
|
|
let exists = fs.existsSync(common.nodes[idx].channel_backup_path + common.path_separator + 'channel-all.bak');
|
|
|
|
|
if (!exists) {
|
|
|
|
|
try {
|
|
|
|
|
var createStream = fs.createWriteStream(common.nodes[idx].channel_backup_path + '/channel-all.bak');
|
|
|
|
|
var createStream = fs.createWriteStream(common.nodes[idx].channel_backup_path + common.path_separator + 'channel-all.bak');
|
|
|
|
|
createStream.end();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Something went wrong while creating backup file: \n' + err);
|
|
|
|
@ -431,7 +432,7 @@ connect.logEnvVariables = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect.getAllNodeAllChannelBackup = (node) => {
|
|
|
|
|
let channel_backup_file = node.channel_backup_path + '/channel-all.bak';
|
|
|
|
|
let channel_backup_file = node.channel_backup_path + common.path_separator + 'channel-all.bak';
|
|
|
|
|
let options = {
|
|
|
|
|
url: node.lnd_server_url + '/channels/backup',
|
|
|
|
|
rejectUnauthorized: false,
|
|
|
|
|