Skip to content

Commit

Permalink
Config write func
Browse files Browse the repository at this point in the history
  • Loading branch information
nedobylskiy committed Feb 19, 2020
1 parent 4b5490e commit ca91e89
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ program
.option('--clear', 'Clear all saved chain and deletes wallet. WARNING: You can lose important data')
.option('--clear-db', 'Clear all saved chain and calculated wallets.')
.option('-c, --config [path]', 'Core config path', 'config.json')
.option('--write-config [path]', 'Save config in [path] file', false)
.option('--work-dir [path]', 'Working directory', false)
.option('--keyring-emission', 'Generate and deploy keyring', false)
.option('--generate-wallets [keyring path]', 'Generate wallets from keyring file', false)
Expand Down Expand Up @@ -170,14 +171,17 @@ try {
}
}


/* try {
fs.writeFileSync('config.json', JSON.stringify(config));
} catch (e) {
console.log('Info: Can\'t save config');
}*/
} catch (e) {
logger.info('No configure found. Using standard configuration.');
logger.warning('No configure found. Using standard configuration.');
}


if(program.writeConfig) {
try {
fs.writeFileSync(program.writeConfig, JSON.stringify(config));
} catch (e) {
logger.warning('Can\'t save config');
}
}

config.program = program;
Expand Down

0 comments on commit ca91e89

Please sign in to comment.