Browse Source

update code for detecting difference between old and new

Yuki Takei 1 year ago
parent
commit
f82529e433
1 changed files with 14 additions and 2 deletions
  1. 14 2
      apps/app/src/server/service/config-manager/config-manager.ts

+ 14 - 2
apps/app/src/server/service/config-manager/config-manager.ts

@@ -94,10 +94,22 @@ export class ConfigManager implements IConfigManagerForApp, S2sMessageHandlable
         : (this.dbConfig[key] ?? this.envConfig[key])?.value;
         : (this.dbConfig[key] ?? this.envConfig[key])?.value;
     })() as ConfigValues[K];
     })() as ConfigValues[K];
 
 
-    const valueByLegacy = configManagerLegacy.getConfig(ns, key);
+    const valueByLegacy = (() => {
+      if (source === ConfigSource.env) {
+        return configManagerLegacy.getConfigFromEnvVars(ns, key);
+      }
+      if (source === ConfigSource.db) {
+        return configManagerLegacy.getConfigFromDB(ns, key);
+      }
+      return configManagerLegacy.getConfig(ns, key);
+    })();
+
     if (value !== valueByLegacy) {
     if (value !== valueByLegacy) {
       if (!(value === undefined && valueByLegacy === null)) {
       if (!(value === undefined && valueByLegacy === null)) {
-        logger.warn(`The value of the config key '${key}' is different between the new and legacy config managers: `, { value, valueByLegacy });
+        logger.warn(
+          `The value of the config key '${key}' ${source != null ? `(source: ${source})` : ''} is different between the new and legacy config managers:`,
+          { value, valueByLegacy },
+        );
       }
       }
     }
     }