Просмотр исходного кода

Merge branch 'imprv/abolish-old-config-api-fix-installer' into imprv/abolish-old-config-api-customize

mizozobu 6 лет назад
Родитель
Сommit
eb1b11447c

+ 0 - 3
src/server/crowi/express-init.js

@@ -22,12 +22,9 @@ module.exports = function(crowi, app) {
 
   const avoidSessionRoutes = require('../routes/avoid-session-routes');
   const i18nUserSettingDetector = require('../util/i18nUserSettingDetector');
-  const middleware = require('../util/middlewares');
 
   const env = crowi.node_env;
 
-  // Old type config API
-  const Config = crowi.model('Config');
   // New type config API
   const configManager = crowi.configManager;
   const getConfig = configManager.getConfig;

+ 1 - 1
src/server/models/config.js

@@ -66,7 +66,7 @@ module.exports = function(crowi) {
       'security:list-policy:hideRestrictedByOwner' : false,
       'security:list-policy:hideRestrictedByGroup' : false,
 
-      'security:isEnabledPassport' : false,
+      'security:isEnabledPassport' : true,
       'security:passport-ldap:isEnabled' : false,
       'security:passport-ldap:serverUrl' : undefined,
       'security:passport-ldap:isUserBind' : undefined,

+ 5 - 0
src/server/service/config-manager.js

@@ -205,26 +205,31 @@ class ConfigManager {
   defaultSearch(namespace, key) {
     // does not exist neither in db nor in env vars
     if (!this.configExistsInDB(namespace, key) && !this.configExistsInEnvVars(namespace, key)) {
+      debug(`${namespace}.${key} does not exist neither in db nor in env vars`);
       return undefined;
     }
 
     // only exists in db
     if (this.configExistsInDB(namespace, key) && !this.configExistsInEnvVars(namespace, key)) {
+      debug(`${namespace}.${key} only exists in db`);
       return this.configObject.fromDB[namespace][key];
     }
 
     // only exists env vars
     if (!this.configExistsInDB(namespace, key) && this.configExistsInEnvVars(namespace, key)) {
+      debug(`${namespace}.${key} only exists in db`);
       return this.configObject.fromEnvVars[namespace][key];
     }
 
     // exists both in db and in env vars [db > env var]
     if (this.configExistsInDB(namespace, key) && this.configExistsInEnvVars(namespace, key)) {
       if (this.configObject.fromDB[namespace][key] !== null) {
+        debug(`${namespace}.${key} exists both in db and in env vars. loaded from db`);
         return this.configObject.fromDB[namespace][key];
       }
       /* eslint-disable-next-line no-else-return */
       else {
+        debug(`${namespace}.${key} exists both in db and in env vars. loaded from env vars`);
         return this.configObject.fromEnvVars[namespace][key];
       }
     }