Skip to content

Commit

Permalink
added support for MEILI_MASTER_KEY
Browse files Browse the repository at this point in the history
it's the environment variable we should have been
using since the start
  • Loading branch information
masukomi committed Jul 12, 2024
1 parent 07cc75d commit 8e6c409
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
mongodb_meilisearch (1.2.1)
mongodb_meilisearch (1.3.0)
meilisearch
mongoid (~> 7.0)
rails
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The url below is the default one Meilisearch uses when run locally.

```bash
SEARCH_ENABLED=true
MEILISEARCH_API_KEY=<your api key here>
MEILI_MASTER_KEY=<your api key here>
MEILISEARCH_URL=http://127.0.0.1:7700

```
Expand Down
2 changes: 1 addition & 1 deletion lib/mongodb_meilisearch/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module MongodbMeilisearch
# @note This library will adhere to strict semantic versioning.
# See https://semver.org/
#
VERSION = "1.2.1"
VERSION = "1.3.0"
end
3 changes: 2 additions & 1 deletion lib/search/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Client
def initialize
if ENV.fetch("SEARCH_ENABLED", "true") == "true"
url = ENV.fetch("MEILISEARCH_URL")
api_key = ENV.fetch("MEILISEARCH_API_KEY")
# MEILISEARCH_API_KEY is for mongodb_meilisearch v1.2.1 & earlier
api_key = ENV.fetch("MEILI_MASTER_KEY") || ENV.fetch("MEILISEARCH_API_KEY")
timeout = ENV.fetch("MEILISEARCH_TIMEOUT", 10).to_i
max_retries = ENV.fetch("MEILISEARCH_MAX_RETRIES", 2).to_i
if url.present? && api_key.present?
Expand Down

0 comments on commit 8e6c409

Please sign in to comment.