Move database directory to constants
This commit is contained in:
parent
fd4088b2a5
commit
a8d0cb5b19
2 changed files with 4 additions and 5 deletions
|
|
@ -1 +1,2 @@
|
|||
export const LOG_NAME: string = `Secret Hitler`;
|
||||
export const LOG_NAME: string = `Secret Hitler`;
|
||||
export const DB_DIR: string = `data`;
|
||||
|
|
@ -4,11 +4,11 @@ import * as sio from "socket.io";
|
|||
import { writeFileSync } from "fs";
|
||||
import { Game } from "./utils/Game";
|
||||
import { Vote } from "./events/Vote";
|
||||
import { LOG_NAME } from "./constants";
|
||||
import { KillGame } from "./events/KillGame";
|
||||
import { JoinGame } from "./events/JoinGame";
|
||||
import { HostGame } from "./events/HostGame";
|
||||
import { StartGame } from "./events/StartGame";
|
||||
import { LOG_NAME, DB_DIR } from "./constants";
|
||||
import { VetoConfirm } from "./events/VetoConfirm";
|
||||
import { VetoRequest } from "./events/VetoRequest";
|
||||
import { RemovePlayer } from "./events/RemovePlayer";
|
||||
|
|
@ -51,8 +51,6 @@ export var log: Logger = new Logger({
|
|||
|
||||
export var active_games: {[key: string]: Game} = {};
|
||||
|
||||
const db_dir = `data`;
|
||||
|
||||
/**
|
||||
* This function is called whenever the main node process is terminated for
|
||||
* whatever reason. It cleans up and writes all the active games to the disk.
|
||||
|
|
@ -62,7 +60,7 @@ function clean_up() {
|
|||
for (var code in active_games) {
|
||||
log.debug(`Writing game: ${code} to disk`);
|
||||
log.silly(active_games[code].toString());
|
||||
// writeFileSync(`${db_dir}/${code}`, active_games[code].toJSON());
|
||||
// writeFileSync(`${DB__DIR}/${code}`, active_games[code].toJSON());
|
||||
};
|
||||
log.info(`Finished cleanup. Exiting.`);
|
||||
process.exit(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue