MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / loadConfig

Function loadConfig

bin/lib/cli-utils.mjs:18–42  ·  view source on GitHub ↗
(program, options)

Source from the content-addressed store, hash-verified

16}
17
18export 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
44export function loadAccounts ({ root, serverUri, hostname }) {
45 const files = fs.readdirSync(root)

Callers 3

updateIndex.mjsFile · 0.90
start.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected