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

39 lines
837 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;
gameOptions: GameOptions;
2022-07-17 15:14:23 +01:00
unix?: UnixOptions;
2022-07-17 15:01:48 +01:00
notices?: string[];
2022-07-17 15:14:23 +01:00
}
export interface UnixOptions {
setuid: number;
setgid: number;
}
export interface GameOptions {
// Amount of full-tunes to grant to newly registered cards
grantFullTuneTicketToNewUsers: number;
}
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;
}
}