21 lines
321 B
JavaScript
21 lines
321 B
JavaScript
const fs = require('fs');
|
|
|
|
if (!global.config) {
|
|
global.config = {}
|
|
const cfg = JSON.parse(fs.readFileSync('./config.json'));
|
|
if (cfg) {
|
|
global.config = cfg;
|
|
}
|
|
}
|
|
|
|
class Config {
|
|
get config() {
|
|
return global.config;
|
|
}
|
|
|
|
set config(dat) {
|
|
global.config = dat;
|
|
}
|
|
}
|
|
|
|
module.exports = new Config(); |