Browse Source

set configKeys after updating cache

mizozobu 7 years ago
parent
commit
9b888c504b
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/server/service/config-manager.js

+ 7 - 2
src/server/service/config-manager.js

@@ -32,7 +32,7 @@ class ConfigManager {
     debug('ConfigManager#loadConfigs', this.configObject);
 
     // cache all config keys
-    this.configKeys = this.getAllConfigKeys();
+    this.setConfigKeys();
   }
 
   /**
@@ -82,7 +82,7 @@ class ConfigManager {
   /**
    * generate an array of config keys from this.configObject
    */
-  getAllConfigKeys() {
+  getConfigKeys() {
     // type: fromDB, fromEnvVars
     const types = Object.keys(this.configObject);
     let namespaces = [];
@@ -112,6 +112,10 @@ class ConfigManager {
     return keys;
   }
 
+  setConfigKeys() {
+    this.configKeys = this.getConfigKeys();
+  }
+
   /**
    * get a config specified by namespace & key from configs loaded from the database
    *
@@ -178,6 +182,7 @@ class ConfigManager {
     await this.configModel.bulkWrite(queries);
 
     await this.loadConfigs();
+    this.setConfigKeys();
   }
 
   /**