Skip to content

Commit 2fd6f26

Browse files
gschmutzjinhyukchang
authored andcommitted
Set the elasticsearch base (endpoint) from env variable (#16)
* support setting ELASTICSEARCH_BASE through environment variable * update formating to fix the CI error * Update config.py
1 parent d32e79d commit 2fd6f26

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

search_service/config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
ELASTICSEARCH_ENDPOINT_KEY = 'ELASTICSEARCH_ENDPOINT'
24
ELASTICSEARCH_INDEX_KEY = 'ELASTICSEARCH_INDEX'
35
ELASTICSEARCH_AUTH_USER_KEY = 'ELASTICSEARCH_AUTH_USER'
@@ -19,7 +21,12 @@ class LocalConfig(Config):
1921
TESTING = False
2022
STATS = False
2123
LOCAL_HOST = '0.0.0.0'
22-
ELASTICSEARCH_ENDPOINT = 'http://{LOCAL_HOST}:9200'.format(LOCAL_HOST=LOCAL_HOST)
24+
ELASTICSEARCH_PORT = '9200'
25+
ELASTICSEARCH_ENDPOINT = os.environ.get('ELASTICSEARCH_ENDPOINT',
26+
'http://{LOCAL_HOST}:{PORT}'.format(
27+
LOCAL_HOST=LOCAL_HOST,
28+
PORT=ELASTICSEARCH_PORT)
29+
)
2330
ELASTICSEARCH_INDEX = 'table_search_index'
2431
ELASTICSEARCH_AUTH_USER = 'elastic'
2532
ELASTICSEARCH_AUTH_PW = 'elastic'

0 commit comments

Comments
 (0)