Procházet zdrojové kódy

Merge pull request #2776 from weseek/feat/GW-3661-show-env-var-in-GCP-settings

Feat/gw 3661 show env var in gcp settings
Yuki Takei před 5 roky
rodič
revize
6960febc7b

+ 3 - 0
src/client/js/services/AdminAppContainer.js

@@ -91,6 +91,9 @@ export default class AdminAppContainer extends Container {
       bucket: appSettingsParams.bucket,
       accessKeyId: appSettingsParams.accessKeyId,
       secretAccessKey: appSettingsParams.secretAccessKey,
+      envGcsApiKeyJsonPath: appSettingsParams.envGcsApiKeyJsonPath,
+      envGcsBucket: appSettingsParams.envGcsBucket,
+      envGcsUploadNamespace: appSettingsParams.envGcsUploadNamespace,
       isEnabledPlugins: appSettingsParams.isEnabledPlugins,
     });
   }

+ 12 - 0
src/server/routes/apiv3/app-settings.js

@@ -118,6 +118,15 @@ const ErrorV3 = require('../../models/vo/error-apiv3');
  *          gcsUploadNamespace:
  *            type: string
  *            description: name space of gcs
+ *          envGcsApiKeyJsonPath:
+ *            type: string
+ *            description: Path of the JSON file that contains service account key to authenticate to GCP API
+ *          envGcsBucket:
+ *            type: string
+ *            description: Name of the GCS bucket
+ *          envGcsUploadNamespace:
+ *            type: string
+ *            description: Directory name to create in the bucket
  *      PluginSettingParams:
  *        description: PluginSettingParams
  *        type: object
@@ -218,6 +227,9 @@ module.exports = (crowi) => {
       bucket: crowi.configManager.getConfig('crowi', 'aws:bucket'),
       accessKeyId: crowi.configManager.getConfig('crowi', 'aws:accessKeyId'),
       secretAccessKey: crowi.configManager.getConfig('crowi', 'aws:secretAccessKey'),
+      envGcsApiKeyJsonPath: crowi.configManager.getConfigFromEnvVars('crowi', 'gcs:apiKeyJsonPath'),
+      envGcsBucket: crowi.configManager.getConfigFromEnvVars('crowi', 'gcs:bucket'),
+      envGcsUploadNamespace: crowi.configManager.getConfigFromEnvVars('crowi', 'gcs:uploadNamespace'),
       isEnabledPlugins: crowi.configManager.getConfig('crowi', 'plugin:isEnabledPlugins'),
     };
     return res.apiv3({ appSettingsParams });