Skip to content

Commit

Permalink
Use WDR_SEARCH_INDEX_BASENAME config in search.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Ngai committed Jun 28, 2024
1 parent e78a7f6 commit dc401cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions woudc_data_registry/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@
WDR_DB_NAME = os.getenv('WDR_DB_NAME')
WDR_SEARCH_TYPE = os.getenv('WDR_SEARCH_TYPE', 'elasticsearch')
WDR_SEARCH_URL = os.getenv('WDR_SEARCH_URL')
WDR_SEARCH_INDEX_BASENAME=os.getenv('WDR_SEARCH_INDEX_BASENAME')
WDR_WAF_BASEDIR = os.getenv('WDR_WAF_BASEDIR')
WDR_WAF_BASEURL = os.getenv('WDR_WAF_BASEURL', 'https://woudc.org/archive')
WDR_ERROR_CONFIG = os.getenv('WDR_ERROR_CONFIG')
WDR_ALIAS_CONFIG = os.getenv('WDR_ALIAS_CONFIG')
WDR_EXTRA_CONFIG = os.getenv('WDR_EXTRA_CONFIG')
WDR_UV_INDEX_FORMULA_LOOKUP = os.getenv('WDR_UV_INDEX_FORMULA_LOOKUP')

if not WDR_SEARCH_INDEX_BASENAME:
msg = 'WDR_SEARCH_INDEX_BASENAME was not set. Defaulting to: woudc_data_registry'
LOGGER.warning(msg)
WDR_SEARCH_INDEX_BASENAME = 'woudc_data_registry'

if WDR_SEARCH_URL is not None:
WDR_SEARCH_URL = WDR_SEARCH_URL.rstrip('/')

Expand Down
2 changes: 1 addition & 1 deletion woudc_data_registry/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ def __init__(self):

self.type = config.WDR_SEARCH_TYPE
self.url = config.WDR_SEARCH_URL
self.index_basename = 'woudc-data-registry'
self.index_basename = config.WDR_SEARCH_INDEX_BASENAME

LOGGER.debug('Connecting to Elasticsearch')

Expand Down

0 comments on commit dc401cb

Please sign in to comment.