21 lines
441 B
TypeScript
21 lines
441 B
TypeScript
|
import fs from 'fs';
|
||
|
|
||
|
export interface ConfigFile {
|
||
|
shopName: string;
|
||
|
shopNickname: string;
|
||
|
}
|
||
|
|
||
|
export class Config {
|
||
|
private static cfg: ConfigFile;
|
||
|
|
||
|
static load() {
|
||
|
console.log('Loading config file...');
|
||
|
let cfg = fs.readFileSync('./config.json', 'utf-8');
|
||
|
let json = JSON.parse(cfg);
|
||
|
this.cfg = json as ConfigFile;
|
||
|
}
|
||
|
|
||
|
static getConfig(): ConfigFile {
|
||
|
return this.cfg;
|
||
|
}
|
||
|
}
|