utsushiiro 7 лет назад
Родитель
Сommit
f4f0c7520f
2 измененных файлов с 8 добавлено и 7 удалено
  1. 7 6
      src/server/models/config.js
  2. 1 1
      src/server/service/config-loader.js

+ 7 - 6
src/server/models/config.js

@@ -149,6 +149,13 @@ module.exports = function(crowi) {
     return config.markdown[key];
   }
 
+  /**
+   * It is deprecated to use this for anything other than ConfigLoader#load.
+   */
+  configSchema.statics.getDefaultCrowiConfigsObject = function() {
+    return getDefaultCrowiConfigs();
+  };
+
   configSchema.statics.getRestrictGuestModeLabels = function() {
     var labels = {};
     labels[SECURITY_RESTRICT_GUEST_MODE_DENY]     = 'security_setting.guest_mode.deny';
@@ -200,12 +207,6 @@ module.exports = function(crowi) {
     });
   };
 
-  /**
-   * ## Note ##
-   * This method creates a config object that merge a cache into a defaults.
-   * This can be used to get the config values that reflect the database values and the default values.
-   * So, this method should be renamed to more a general name.
-   */
   configSchema.statics.setupConfigFormData = function(ns, config) {
     var defaultConfig = {};
 

+ 1 - 1
src/server/service/config-loader.js

@@ -50,7 +50,7 @@ class ConfigLoader {
     const configFromDB = await this.loadFromDB();
     const configFromEnvVars = this.loadFromEnvVars();
 
-    const mergedConfigFromDB = this.configModel.setupConfigFormData('crowi', configFromDB);
+    const mergedConfigFromDB = Object.assign({'crowi': this.configModel.getDefaultCrowiConfigsObject()}, configFromDB);
 
     return {
       fromDB: mergedConfigFromDB,