1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 17:00:58 -05:00
Daggerbot-TS/src/helpers/ConfigHelper.ts

16 lines
487 B
TypeScript
Raw Normal View History

2023-10-07 17:01:16 -04:00
import {readFileSync} from 'node:fs';
import {Config} from '../typings/interfaces';
export default class ConfigHelper {
static loadConfig(configFile:string) {
let importconfig:Config;
try {
importconfig = JSON.parse(readFileSync(configFile, 'utf8'));
console.log(`Loaded the config :: ${importconfig.configName}`);
2023-10-07 17:01:16 -04:00
} catch (e) {
console.error(`Error loading config file "${configFile}": ${e}`);
process.exit(1);
}
return importconfig;
}
}