allow adjusting of config path
This commit is contained in:
parent
f33ac57b63
commit
02c4a0a4a3
1 changed files with 7 additions and 1 deletions
|
@ -30,9 +30,15 @@ console.log(` ___) | |_) |__) | |_| |_) | (_) | |_ `)
|
|||
console.log(`|____/|_.__/____/ \\__|____/ \\___/ \\__|`)
|
||||
console.log(` `)
|
||||
|
||||
let configPath = process.env["CONFIG_FILE"]
|
||||
if (configPath === undefined) {
|
||||
console.log(`"CONFIG_FILE" not defined, defaulting to "./config.json"`)
|
||||
configPath = "./config.json"
|
||||
}
|
||||
|
||||
let config
|
||||
try {
|
||||
const raw = await fs.readFile("./config.json", "utf-8")
|
||||
const raw = await fs.readFile(configPath, "utf-8")
|
||||
config = JSON.parse(raw)
|
||||
} catch (e) {
|
||||
console.error(`Failed to read config: ${e}`)
|
||||
|
|
Loading…
Add table
Reference in a new issue