zahmis 5 лет назад
Родитель
Сommit
708744dfd3

+ 4 - 4
src/client/js/services/AdminAppContainer.js

@@ -364,7 +364,7 @@ export default class AdminAppContainer extends Container {
     if (this.state.fileUploadType === 'aws') {
       return this.updateAwsSettingHandler();
     }
-    return this.updateGcpSettingHandler();
+    return this.updateGcsSettingHandler();
   }
 
   /**
@@ -386,12 +386,12 @@ export default class AdminAppContainer extends Container {
   }
 
   /**
-   * Update GCP setting
+   * Update GCS setting
    * @memberOf AdminAppContainer
    * @return {Array} Appearance
    */
-  async updateGcpSettingHandler() {
-    const response = await this.appContainer.apiv3.put('/app-settings/gcp-setting', {
+  async updateGcsSettingHandler() {
+    const response = await this.appContainer.apiv3.put('/app-settings/gcs-setting', {
       fileUploadType: this.state.fileUploadType,
       gcsApiKeyJsonPath: this.state.gcsApiKeyJsonPath,
       gcsBucket: this.state.gcsBucket,

+ 17 - 17
src/server/routes/apiv3/app-settings.js

@@ -105,13 +105,13 @@ const ErrorV3 = require('../../models/vo/error-apiv3');
  *          secretAccessKey:
  *            type: string
  *            description: secret key for authentification of AWS
- *      GcpSettingParams:
- *        description: GcpSettingParams
+ *      GcsSettingParams:
+ *        description: GcsSettingParams
  *        type: object
  *        properties:
  *          gcsApiKeyJsonPath:
  *            type: string
- *            description: apiKeyJsonPath of gcp
+ *            description: apiKeyJsonPath of gcs
  *          gcsBucket:
  *            type: string
  *            description: bucket name of gcs
@@ -120,7 +120,7 @@ const ErrorV3 = require('../../models/vo/error-apiv3');
  *            description: name space of gcs
  *          envGcsApiKeyJsonPath:
  *            type: string
- *            description: Path of the JSON file that contains service account key to authenticate to GCP API
+ *            description: Path of the JSON file that contains service account key to authenticate to GCS API
  *          envGcsBucket:
  *            type: string
  *            description: Name of the GCS bucket
@@ -175,7 +175,7 @@ module.exports = (crowi) => {
       body('s3AccessKeyId').trim().if(value => value !== '').matches(/^[\da-zA-Z]+$/),
       body('s3SecretAccessKey').trim(),
     ],
-    gcpSetting: [
+    gcsSetting: [
       body('gcsApiKeyJsonPath').trim(),
       body('gcsBucket').trim(),
       body('gcsUploadNamespace').trim(),
@@ -604,28 +604,28 @@ module.exports = (crowi) => {
   /**
    * @swagger
    *
-   *    /app-settings/gcp-setting:
+   *    /app-settings/gcs-setting:
    *      put:
    *        tags: [AppSettings]
-   *        operationId: updateAppSettingGcpSetting
-   *        summary: /app-settings/gcp-setting
-   *        description: Update gcp setting
+   *        operationId: updateAppSettingGcsSetting
+   *        summary: /app-settings/gcs-setting
+   *        description: Update gcs setting
    *        requestBody:
    *          required: true
    *          content:
    *            application/json:
    *              schema:
-   *                $ref: '#/components/schemas/GcpSettingParams'
+   *                $ref: '#/components/schemas/GcsSettingParams'
    *        responses:
    *          200:
-   *            description: Succeeded to update gcp setting
+   *            description: Succeeded to update gcs setting
    *            content:
    *              application/json:
    *                schema:
-   *                  $ref: '#/components/schemas/GcpSettingParams'
+   *                  $ref: '#/components/schemas/GcsSettingParams'
    */
-  router.put('/gcp-setting', loginRequiredStrictly, adminRequired, csrf, validator.gcpSetting, apiV3FormValidator, async(req, res) => {
-    const requestGcpSettingParams = {
+  router.put('/gcs-setting', loginRequiredStrictly, adminRequired, csrf, validator.gcsSetting, apiV3FormValidator, async(req, res) => {
+    const requestGcsSettingParams = {
       'app:fileUploadType': req.body.fileUploadType,
       'gcs:apiKeyJsonPath': req.body.gcsApiKeyJsonPath,
       'gcs:bucket': req.body.gcsBucket,
@@ -633,16 +633,16 @@ module.exports = (crowi) => {
     };
 
     try {
-      await crowi.configManager.updateConfigsInTheSameNamespace('crowi', requestGcpSettingParams, true);
+      await crowi.configManager.updateConfigsInTheSameNamespace('crowi', requestGcsSettingParams, true);
       await crowi.setUpFileUpload(true);
       crowi.fileUploaderSwitchService.publishUpdatedMessage();
 
-      const gcpSettingParams = {
+      const gcsSettingParams = {
         gcsApiKeyJsonPath: crowi.configManager.getConfig('crowi', 'gcs:apiKeyJsonPath'),
         gcsBucket: crowi.configManager.getConfig('crowi', 'gcs:bucket'),
         gcsUploadNamespace: crowi.configManager.getConfig('crowi', 'gcs:uploadNamespace'),
       };
-      return res.apiv3({ gcpSettingParams });
+      return res.apiv3({ gcsSettingParams });
     }
     catch (err) {
       const msg = 'Error occurred in updating aws setting';

+ 2 - 2
src/server/service/config-loader.js

@@ -344,9 +344,9 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type:    TYPES.STRING,
     default: null,
   },
-  IS_GCP_ENV_PRIORITIZED: {
+  IS_GCS_ENV_PRIORITIZED: {
     ns:      'crowi',
-    key:     'gcs:isGcpEnvPrioritizes',
+    key:     'gcs:isGcsEnvPrioritizes',
     type:    TYPES.BOOLEAN,
     default: false,
   },

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

@@ -24,11 +24,15 @@ const KEYS_FOR_SAML_USE_ONLY_ENV_OPTION = [
   'security:passport-saml:ABLCRule',
 ];
 
+<<<<<<< HEAD
 const KEYS_FOR_FIEL_UPLOAD_USE_ONLY_ENV_OPTION = [
   'app:fileUploadType',
 ];
 
 const KEYS_FOR_GCP_USE_ONLY_ENV_OPTION = [
+=======
+const KEYS_FOR_GCS_USE_ONLY_ENV_OPTION = [
+>>>>>>> 0b168e6e8... change name in endpoint and config
   'gcs:apiKeyJsonPath',
   'gcs:bucket',
   'gcs:uploadNamespace',
@@ -231,10 +235,10 @@ class ConfigManager extends S2sMessageHandlable {
       // file upload option
       // [TODO GW-4173] control with the env var gcs:isFileUploadEnvPrioritizes
       || KEYS_FOR_FIEL_UPLOAD_USE_ONLY_ENV_OPTION.includes(key)
-      // gcp option
+      // gcs option
       || (
-        KEYS_FOR_GCP_USE_ONLY_ENV_OPTION.includes(key)
-        && this.searchOnlyFromEnvVarConfigs('crowi', 'gcs:isGcpEnvPrioritizes')
+        KEYS_FOR_GCS_USE_ONLY_ENV_OPTION.includes(key)
+        && this.searchOnlyFromEnvVarConfigs('crowi', 'gcs:isGcsEnvPrioritizes')
       )
     ));
   }