diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2020-03-20 14:00:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-20 14:00:34 +0900 |
| commit | 5bbd4ae703f12b20e1f308f430b65f9e30bfff21 (patch) | |
| tree | aee132c07f013cb3eb0c0d4f2a5347aebff65892 /src | |
| parent | use username if name was empty (#6166) (diff) | |
| download | sharkey-5bbd4ae703f12b20e1f308f430b65f9e30bfff21.tar.gz sharkey-5bbd4ae703f12b20e1f308f430b65f9e30bfff21.tar.bz2 sharkey-5bbd4ae703f12b20e1f308f430b65f9e30bfff21.zip | |
ElasticSearchで認証ができるように (#6158)
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/types.ts | 5 | ||||
| -rw-r--r-- | src/db/elasticsearch.ts | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/config/types.ts b/src/config/types.ts index 78ae025133..a33901bde6 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -27,9 +27,10 @@ export type Source = { elasticsearch: { host: string; port: number; - pass: string; - index?: string; ssl?: boolean; + user?: string; + pass?: string; + index?: string; }; proxy?: string; diff --git a/src/db/elasticsearch.ts b/src/db/elasticsearch.ts index b62e17461a..048e399bdf 100644 --- a/src/db/elasticsearch.ts +++ b/src/db/elasticsearch.ts @@ -33,6 +33,10 @@ const index = { // Init ElasticSearch connection const client = config.elasticsearch ? new elasticsearch.Client({ node: `${config.elasticsearch.ssl ? 'https://' : 'http://'}${config.elasticsearch.host}:${config.elasticsearch.port}`, + auth: (config.elasticsearch.user && config.elasticsearch.pass) ? { + username: config.elasticsearch.user, + password: config.elasticsearch.pass + } : undefined, pingTimeout: 30000 }) : null; |