handle missing config.json

v1.18.x
Barış Soner Uşaklı 7 years ago
parent 5461f9fa5f
commit 14914b7610

@ -9,7 +9,13 @@ module.exports = {
name: 'Delete accidentally long-lived sessions',
timestamp: Date.UTC(2017, 3, 16),
method: function (callback) {
var configJSON = require('../../../config.json');
var configJSON;
try {
configJSON = require('../../../config.json') || { [process.env.database]: true };
} catch (err) {
configJSON = { [process.env.database]: true };
}
var isRedisSessionStore = configJSON.hasOwnProperty('redis');
var progress = this.progress;

@ -8,7 +8,12 @@ module.exports = {
name: 'Change the schema of simple keys so they don\'t use value field (mongodb only)',
timestamp: Date.UTC(2017, 11, 18),
method: function (callback) {
var configJSON = require('../../../config.json');
var configJSON;
try {
configJSON = require('../../../config.json') || { [process.env.database]: true, database: process.env.database };
} catch (err) {
configJSON = { [process.env.database]: true, database: process.env.database };
}
var isMongo = configJSON.hasOwnProperty('mongo') && configJSON.database === 'mongo';
var progress = this.progress;
if (!isMongo) {

Loading…
Cancel
Save