allow adjusting of config path

This commit is contained in:
1e99 2025-07-22 16:24:04 +02:00
parent f33ac57b63
commit 02c4a0a4a3

View file

@ -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}`)