Add data validation to the config
This commit is contained in:
parent
4506b97101
commit
be25b95789
2 changed files with 68 additions and 10 deletions
|
|
@ -2,19 +2,11 @@
|
|||
import "module-alias/register";
|
||||
|
||||
import startWebsocketServer from "./websocket";
|
||||
import { loadConfig } from "./utils/config";
|
||||
import { GameDB } from "./objects/GameDB";
|
||||
import { Logger } from "tslog";
|
||||
import toml from "toml";
|
||||
import fs from "fs";
|
||||
|
||||
// load the config
|
||||
try {
|
||||
var configData = toml.parse(fs.readFileSync("config.toml", "utf-8"));
|
||||
} catch {
|
||||
console.error("Can't find config file. Exiting");
|
||||
process.exit(1);
|
||||
};
|
||||
export const config: IConfig = configData;
|
||||
export const config: IConfig = loadConfig();
|
||||
|
||||
// Define the logger
|
||||
export const log = new Logger({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue