2
0
Эх сурвалжийг харах

impl APP_SITE_URL_USES_ONLY_ENV_VARS

Yuki Takei 2 жил өмнө
parent
commit
17378a1f1c

+ 6 - 0
apps/app/src/server/service/config-loader.ts

@@ -139,6 +139,12 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type:    ValueType.STRING,
     type:    ValueType.STRING,
     default: null,
     default: null,
   },
   },
+  APP_SITE_URL_USES_ONLY_ENV_VARS: {
+    ns:      'crowi',
+    key:     'app:siteUrl:useOnlyEnvVars',
+    type:    ValueType.BOOLEAN,
+    default: false,
+  },
   PUBLISH_OPEN_API: {
   PUBLISH_OPEN_API: {
     ns:      'crowi',
     ns:      'crowi',
     key:     'app:publishOpenAPI',
     key:     'app:publishOpenAPI',

+ 10 - 1
apps/app/src/server/service/config-manager.ts

@@ -11,6 +11,10 @@ import { S2sMessageHandlable } from './s2s-messaging/handlable';
 
 
 const logger = loggerFactory('growi:service:ConfigManager');
 const logger = loggerFactory('growi:service:ConfigManager');
 
 
+const KEYS_FOR_APP_SITE_URL_USES_ONLY_ENV_OPTION = [
+  'app:siteUrl',
+];
+
 const KEYS_FOR_LOCAL_STRATEGY_USE_ONLY_ENV_OPTION = [
 const KEYS_FOR_LOCAL_STRATEGY_USE_ONLY_ENV_OPTION = [
   'security:passport-local:isEnabled',
   'security:passport-local:isEnabled',
 ];
 ];
@@ -233,8 +237,13 @@ export default class ConfigManager implements S2sMessageHandlable {
    */
    */
   shouldSearchedFromEnvVarsOnly(namespace, key) {
   shouldSearchedFromEnvVarsOnly(namespace, key) {
     return (namespace === 'crowi' && (
     return (namespace === 'crowi' && (
-      // local strategy
+      // siteUrl
       (
       (
+        KEYS_FOR_APP_SITE_URL_USES_ONLY_ENV_OPTION.includes(key)
+        && this.defaultSearch('crowi', 'app:siteUrl:useOnlyEnvVars')
+      )
+      // local strategy
+      || (
         KEYS_FOR_LOCAL_STRATEGY_USE_ONLY_ENV_OPTION.includes(key)
         KEYS_FOR_LOCAL_STRATEGY_USE_ONLY_ENV_OPTION.includes(key)
         && this.defaultSearch('crowi', 'security:passport-local:useOnlyEnvVarsForSomeOptions')
         && this.defaultSearch('crowi', 'security:passport-local:useOnlyEnvVarsForSomeOptions')
       )
       )