apply some defaults when loading the config

This commit is contained in:
ansuz 2020-02-28 10:50:30 -05:00
parent 94d8e7f2c2
commit de6b9e2228
1 changed files with 18 additions and 0 deletions

View File

@ -18,5 +18,23 @@ try {
}
config = require("../config/config.example");
}
var isPositiveNumber = function (n) {
return (!isNaN(n) && n >= 0);
};
if (!isPositiveNumber(config.inactiveTime)) {
config.inactiveTime = 90;
}
if (!isPositiveNumber(config.archiveRetentionTime)) {
config.archiveRetentionTime = 90;
}
if (!isPositiveNumber(config.maxUploadSize)) {
config.maxUploadSize = 20 * 1024 * 1024;
}
if (!isPositiveNumber(config.defaultStorageLimit)) {
config.defaultStorageLimit = 50 * 1024 * 1024;
}
module.exports = config;