mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 08:20:58 -05:00
15 lines
493 B
TypeScript
15 lines
493 B
TypeScript
|
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;
|
||
|
}
|
||
|
}
|