Support authentication for ElasticSearch (#16890)

* Support authentication for ElasticSearch

* Fix chewy auth settings
This commit is contained in:
Jeong Arm 2021-10-25 00:20:03 +09:00 committed by noellabo
parent 2b16aca101
commit 0c62e9609b
2 changed files with 7 additions and 0 deletions

View file

@ -28,6 +28,9 @@ DB_PORT=5432
ES_ENABLED=true ES_ENABLED=true
ES_HOST=localhost ES_HOST=localhost
ES_PORT=9200 ES_PORT=9200
# Authentication for ES (optional)
ES_USER=elastic
ES_PASS=password
# Secrets # Secrets
# ------- # -------

View file

@ -1,6 +1,8 @@
enabled = ENV['ES_ENABLED'] == 'true' enabled = ENV['ES_ENABLED'] == 'true'
host = ENV.fetch('ES_HOST') { 'localhost' } host = ENV.fetch('ES_HOST') { 'localhost' }
port = ENV.fetch('ES_PORT') { 9200 } port = ENV.fetch('ES_PORT') { 9200 }
user = ENV.fetch('ES_USER') { nil }
password = ENV.fetch('ES_PASS') { nil }
fallback_prefix = ENV.fetch('REDIS_NAMESPACE') { nil } fallback_prefix = ENV.fetch('REDIS_NAMESPACE') { nil }
prefix = ENV.fetch('ES_PREFIX') { fallback_prefix } prefix = ENV.fetch('ES_PREFIX') { fallback_prefix }
@ -9,6 +11,8 @@ Chewy.settings = {
prefix: prefix, prefix: prefix,
enabled: enabled, enabled: enabled,
journal: false, journal: false,
user: user,
password: password,
sidekiq: { queue: 'pull' }, sidekiq: { queue: 'pull' },
} }