From 172aa5ff41eb57323dca7836f375d24fca3a0cce Mon Sep 17 00:00:00 2001 From: matthew Date: Sun, 2 Oct 2022 19:46:14 +0400 Subject: [PATCH] add elastic env --- searching-front/services/modules/elastic/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searching-front/services/modules/elastic/index.ts b/searching-front/services/modules/elastic/index.ts index 461960f..49abe0d 100644 --- a/searching-front/services/modules/elastic/index.ts +++ b/searching-front/services/modules/elastic/index.ts @@ -44,7 +44,7 @@ class Elastic { private client: Client constructor() { this.client = new Client({ - node: "http://elasticsearch:9200", + node: process.env.ELASTIC_URL || "http://localhost:9200", }) } @@ -91,8 +91,8 @@ class Elastic { public initElastic = async () => { ;[Languages.EN, Languages.RU].forEach(async (lang) => { const indexName = getIndexNameByLang(lang) - const alreadyExist = await this.client.indices.exists({index:indexName}) - if(!alreadyExist){ + const alreadyExist = await this.client.indices.exists({ index: indexName }) + if (!alreadyExist) { await this.createIndex(lang) } })