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

https://youtrack.weseek.co.jp/issue/GW-7632
- Adjust app/.env.developement, service/config-loader.ts and elasticsearch.ts
- Set rejectUnauthorized from global env config

LuqmanHakim-Grune 4 лет назад
Родитель
Сommit
823410913e

+ 1 - 0
packages/app/.env.development

@@ -13,6 +13,7 @@ MONGO_URI="mongodb://mongo:27017/growi"
 # NCHAN_URI="http://nchan"
 ELASTICSEARCH_URI="http://elasticsearch:9200/growi"
 ELASTICSEARCH_REQUEST_TIMEOUT=15000
+ELASTICSEARCH_REJECT_UNAUTHORIZED=false
 HACKMD_URI="http://localhost:3010"
 HACKMD_URI_FOR_SERVER="http://hackmd:3000"
 # DRAWIO_URI="http://localhost:8080/?offline=1&https=0"

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

@@ -262,6 +262,12 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type:    ValueType.STRING,
     default: null,
   },
+  ELASTICSEARCH_REJECT_UNAUTHORIZED: {
+    ns:      'crowi',
+    key:     'app:elasticsearchRejectUnauthorized',
+    type:    ValueType.BOOLEAN,
+    default: false,
+  },
   MONGO_GRIDFS_TOTAL_LIMIT: {
     ns:      'crowi',
     key:     'gridfs:totalLimit',

+ 1 - 1
packages/app/src/server/service/search-delegator/elasticsearch.ts

@@ -94,7 +94,7 @@ class ElasticsearchDelegator implements SearchDelegator<Data> {
 
     this.client = new elasticsearch.Client({
       node: host,
-      ssl: { rejectUnauthorized: false },
+      ssl: { rejectUnauthorized: this.configManager.getConfig('crowi', 'app:elasticsearchRejectUnauthorized') },
       auth,
       requestTimeout: this.configManager.getConfig('crowi', 'app:elasticsearchRequestTimeout'),
       // log: 'debug',