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

15 lines
493 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(`Using development config :: ${importconfig.configName}`);
} catch (e) {
console.error(`Error loading config file "${configFile}": ${e}`);
process.exit(1);
}
return importconfig;
}
}