return (process.env[name] || "").toLowerCase() === "true";
}
-const DEV_ENABLE_SERVING_FILES = envTrue('DEV_ENABLE_SERVING_FILES');
-const DEBUG_LOG = DEV_ENABLE_SERVING_FILES || envTrue('DEBUG_LOG');
+const DEV_ENABLE_SERVING_FILES = envTrue("DEV_ENABLE_SERVING_FILES");
+const DEBUG_LOG = DEV_ENABLE_SERVING_FILES || envTrue("DEBUG_LOG");
if (DEV_ENABLE_SERVING_FILES) {
console.log("DEV_ENABLE_SERVING_FILES: Serving files in the current directory. Please never do this on a production server, this is for development purposes only.");
var games = {};
var dateNow = 0;
-var saveTo = null;
+var saveTimeout = null;
function saveGames() {
fs.writeFile("games.backup.json", JSON.stringify(games), function (err) {
}
});
- saveTo = null;
+ saveTimeout = null;
}
function Game() {
}
}
- if (saveTo === null) {
- saveTo = setTimeout(saveGames, SAVE_TIMEOUT);
+ if (saveTimeout === null) {
+ saveTimeout = setTimeout(saveGames, SAVE_TIMEOUT);
}
};
var post = "";
var responseAndIsES = [response, false];
- response.on("error", function (e) {
+ response.on("error", function connectionError(e) {
console.error("An error occurred while trying to write on a socket", e);
stopKeepAlive(responseAndIsES);
});