1
0
mirror of synced 2025-02-08 15:28:14 +01:00
Bayshore/src/config.ts

26 lines
545 B
TypeScript
Raw Normal View History

import fs from 'fs';
export interface ConfigFile {
shopName: string;
shopNickname: string;
2022-07-13 18:09:13 +01:00
regionName: string;
serverIp?: 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 {
2022-07-13 18:09:13 +01:00
if (!this.cfg)
this.load();
return this.cfg;
}
}