Просмотр исходного кода

refs 114331: get actual vals for serviceType, deploymentType

Futa Arai 3 лет назад
Родитель
Сommit
06ba2af072

+ 13 - 1
packages/app/src/server/service/config-loader.ts

@@ -1,7 +1,7 @@
 import { envUtils } from '@growi/core';
 import { parseISO } from 'date-fns';
 
-
+import { GrowiServiceType } from '~/interfaces/questionnaire/growi-info';
 import loggerFactory from '~/utils/logger';
 
 import ConfigModel, {
@@ -670,6 +670,18 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type: ValueType.BOOLEAN,
     default: true,
   },
+  SERVICE_TYPE: {
+    ns: 'crowi',
+    key: 'app:serviceType',
+    type: ValueType.STRING,
+    default: GrowiServiceType.onPremise,
+  },
+  DEPLOYMENT_TYPE: {
+    ns: 'crowi',
+    key: 'app:deploymentType',
+    type: ValueType.STRING,
+    default: null,
+  },
 };
 
 

+ 3 - 4
packages/app/src/server/service/questionnaire.ts

@@ -30,7 +30,6 @@ class QuestionnaireService {
 
     const currentUsersCount = await User.countDocuments();
     const currentActiveUsersCount = await User.countActiveUsers();
-    const attachmentType = this.crowi.configManager.getConfig('crowi', 'app:fileUploadType');
 
     return {
       version: this.crowi.version,
@@ -42,13 +41,13 @@ class QuestionnaireService {
       },
       appSiteUrl, // TODO: set only if allowed (see: https://dev.growi.org/6385911e1632aa30f4dae6a4#mdcont-%E5%8C%BF%E5%90%8D%E5%8C%96%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%AA%E3%83%97%E3%83%AD%E3%83%91%E3%83%86%E3%82%A3)
       appSiteUrlHashed,
-      type: 'cloud', // TODO: set actual value
+      type: this.crowi.configManager.getConfig('crowi', 'app:serviceType'),
       currentUsersCount,
       currentActiveUsersCount,
       wikiType: 'open', // TODO: set actual value
-      attachmentType,
+      attachmentType: this.crowi.configManager.getConfig('crowi', 'app:fileUploadType'),
       activeExternalAccountTypes: undefined, // TODO: set actual value
-      deploymentType: undefined, // TODO: set actual value
+      deploymentType: this.crowi.configManager.getConfig('crowi', 'app:deploymentType'),
     };
   }