24 lines
385 B
JavaScript
24 lines
385 B
JavaScript
import fs from "fs"
|
|
|
|
let _configFile = "config.json"
|
|
if(process.argv[2]) _configFile = process.argv[2]
|
|
|
|
let _config = null
|
|
|
|
const load = () => {
|
|
if(! fs.existsSync(_configFile)) {
|
|
throw new Error('Config file not found')
|
|
}
|
|
_config = JSON.parse(fs.readFileSync(_configFile))
|
|
}
|
|
|
|
if(! _config) load()
|
|
|
|
const get = () => {
|
|
return structuredClone(_config)
|
|
}
|
|
|
|
export default {
|
|
get,
|
|
}
|