mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 11:36:58 +03:00
Added default options
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
var fs = require('fs');
|
const fs = require('fs');
|
||||||
var config = undefined;
|
let config = {};
|
||||||
|
|
||||||
// Check to see if launched in test mode
|
// Check to see if launched in test mode
|
||||||
if (process.env.npm_lifecycle_script === 'node test.js') {
|
if (process.env.npm_lifecycle_script === 'node test.js') {
|
||||||
@@ -9,4 +9,27 @@ if (process.env.npm_lifecycle_script === 'node test.js') {
|
|||||||
config = JSON.parse(fs.readFileSync('config.json'));
|
config = JSON.parse(fs.readFileSync('config.json'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addDefaults(config, {
|
||||||
|
"port": 80,
|
||||||
|
"behindProxy": "X-Forwarded-For",
|
||||||
|
"db": "./databases/sponsorTimes.db",
|
||||||
|
"privateDB": "./databases/private.db",
|
||||||
|
"createDatabaseIfNotExist": true,
|
||||||
|
"schemaFolder": "./databases",
|
||||||
|
"dbSchema": "./databases/_sponsorTimes.db.sql",
|
||||||
|
"privateDBSchema": "./databases/_private.db.sql",
|
||||||
|
"readOnly": false,
|
||||||
|
"webhooks": [],
|
||||||
|
"categoryList": ["sponsor", "intro", "outro", "interaction", "selfpromo", "music_offtopic"]
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|
||||||
|
// Add defaults
|
||||||
|
function addDefaults(config, defaults) {
|
||||||
|
for (const key in defaults) {
|
||||||
|
if(!config.hasOwnProperty(key)) {
|
||||||
|
config[key] = defaults[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user