(program, options)
| 16 | } |
| 17 | |
| 18 | export function loadConfig (program, options) { |
| 19 | let argv = { |
| 20 | ...options, |
| 21 | version: program.version() |
| 22 | } |
| 23 | const configFile = argv.configFile || './config.json' |
| 24 | try { |
| 25 | const file = fs.readFileSync(configFile) |
| 26 | const config = JSON.parse(file) |
| 27 | argv = { ...config, ...argv } |
| 28 | } catch (err) { |
| 29 | if (typeof argv.configFile !== 'undefined') { |
| 30 | if (!fs.existsSync(configFile)) { |
| 31 | console.log(red(bold('ERR')), 'Config file ' + configFile + " doesn't exist.") |
| 32 | process.exit(1) |
| 33 | } |
| 34 | } |
| 35 | if (fs.existsSync(configFile)) { |
| 36 | console.log(red(bold('ERR')), 'config file ' + configFile + " couldn't be parsed: " + err) |
| 37 | process.exit(1) |
| 38 | } |
| 39 | console.log(cyan(bold('TIP')), 'create a config.json: `$ solid init`') |
| 40 | } |
| 41 | return argv |
| 42 | } |
| 43 | |
| 44 | export function loadAccounts ({ root, serverUri, hostname }) { |
| 45 | const files = fs.readdirSync(root) |
no outgoing calls
no test coverage detected