mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 05:57:04 +03:00
Create DB form schema on start if config option is set
This commit is contained in:
7
index.js
7
index.js
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user