Skip to content

Commit

Permalink
Support authentication for ElasticSearch (mastodon#16890)
Browse files Browse the repository at this point in the history
* Support authentication for ElasticSearch

* Fix chewy auth settings
  • Loading branch information
tribela authored Oct 24, 2021
1 parent ec05931 commit c8ce728
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.production.sample
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ DB_PORT=5432
ES_ENABLED=true
ES_HOST=localhost
ES_PORT=9200
# Authentication for ES (optional)
ES_USER=elastic
ES_PASS=password

# Secrets
# -------
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/chewy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
enabled = ENV['ES_ENABLED'] == 'true'
host = ENV.fetch('ES_HOST') { 'localhost' }
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 }
prefix = ENV.fetch('ES_PREFIX') { fallback_prefix }

Expand All @@ -9,6 +11,8 @@
prefix: prefix,
enabled: enabled,
journal: false,
user: user,
password: password,
sidekiq: { queue: 'pull' },
}

Expand Down

0 comments on commit c8ce728

Please sign in to comment.