Create DB form schema on start if config option is set

This commit is contained in:
Joe Dowd
2020-02-13 00:03:09 +00:00
parent 2cfe8964f3
commit 7acb19756b
2 changed files with 10 additions and 2 deletions

View File

@@ -29,6 +29,11 @@ var db = new Sqlite3(config.db, options);
//where the more sensitive data such as IP addresses are stored
var privateDB = new Sqlite3(config.privateDB, options);
if (config.createDatabaseIfNotExist && (config.mode === "development")) {
db.exec(fs.readFileSync(config.dbSchema).toString());
privateDB.exec(fs.readFileSync(config.privateDBSchema).toString());
}
// Create an HTTP service.
http.createServer(app).listen(config.port);
@@ -1049,4 +1054,4 @@ function getFormattedTime(seconds) {
let formatted = minutes+ ":" + secondsDisplay;
return formatted;
}
}