瀏覽代碼

rename methods

utsushiiro 7 年之前
父節點
當前提交
427eb35a4f
共有 1 個文件被更改,包括 14 次插入6 次删除
  1. 14 6
      src/server/service/config-manager.js

+ 14 - 6
src/server/service/config-manager.js

@@ -41,19 +41,19 @@ class ConfigManager {
    * - undefined: a specified config does not exist.
    * - undefined: a specified config does not exist.
    */
    */
   defaultSearch(namespace, key) {
   defaultSearch(namespace, key) {
-    if (!this.isExistInDB(namespace, key) && !this.isExistInEnvVars(namespace, key)) {
+    if (!this.configExistsInDB(namespace, key) && !this.configExistsInEnvVars(namespace, key)) {
       return undefined;
       return undefined;
     }
     }
 
 
-    if (this.isExistInDB(namespace, key) && !this.isExistInEnvVars(namespace, key) ) {
+    if (this.configExistsInDB(namespace, key) && !this.configExistsInEnvVars(namespace, key) ) {
       return this.configObject.fromDB[namespace][key];
       return this.configObject.fromDB[namespace][key];
     }
     }
 
 
-    if (!this.isExistInDB(namespace, key) && this.isExistInEnvVars(namespace, key) ) {
+    if (!this.configExistsInDB(namespace, key) && this.configExistsInEnvVars(namespace, key) ) {
       return this.configObject.fromEnvVars[namespace][key];
       return this.configObject.fromEnvVars[namespace][key];
     }
     }
 
 
-    if (this.isExistInDB(namespace, key) && this.isExistInEnvVars(namespace, key) ) {
+    if (this.configExistsInDB(namespace, key) && this.configExistsInEnvVars(namespace, key) ) {
       if (this.configObject.fromDB[namespace][key] !== null) {
       if (this.configObject.fromDB[namespace][key] !== null) {
         return this.configObject.fromDB[namespace][key];
         return this.configObject.fromDB[namespace][key];
       }
       }
@@ -63,7 +63,11 @@ class ConfigManager {
     }
     }
   }
   }
 
 
-  isExistInDB(namespace, key) {
+  /**
+   * check whether a specified config exists in configs loaded from the database
+   * @returns {boolean}
+   */
+  configExistsInDB(namespace, key) {
     if (this.configObject.fromDB[namespace] === undefined) {
     if (this.configObject.fromDB[namespace] === undefined) {
       return false;
       return false;
     }
     }
@@ -71,7 +75,11 @@ class ConfigManager {
     return this.configObject.fromDB[namespace][key] !== undefined;
     return this.configObject.fromDB[namespace][key] !== undefined;
   }
   }
 
 
-  isExistInEnvVars(namespace, key) {
+  /**
+   * check whether a specified config exists in configs loaded from the environment variables
+   * @returns {boolean}
+   */
+  configExistsInEnvVars(namespace, key) {
     if (this.configObject.fromEnvVars[namespace] === undefined) {
     if (this.configObject.fromEnvVars[namespace] === undefined) {
       return false;
       return false;
     }
     }