From 49c5e19dd7e00ad7f59e7a70e0a295a01c7a06f6 Mon Sep 17 00:00:00 2001 From: yzqzss Date: Sun, 18 Feb 2024 23:42:13 +0800 Subject: [PATCH] rename `MEILI_HOST` to `MEILI_URL` --- README.md | 5 +++-- saveweb-search-backend.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6ae41a5..c627dbb 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,11 @@ pip install -r requirements.txt ## Setup environment variables ```bash +MEILI_URL # MeiliSearch host. +# default: "http://localhost:7700" MEILI_KEY # MeiliSearch API key. # default: '' (empty string) -MEILI_HOST # MeiliSearch host. -# default: "http://localhost:7700" + STWP_SEARCH_MAX_LOAD # If the load is higher than this, API will return 503. # default: cpu_count / 1.5 STWP_SEARCH_MAX_FLYING_OPS # If the number of flying requests is higher than this, API will return 503. diff --git a/saveweb-search-backend.py b/saveweb-search-backend.py index 74f6fba..01f3e90 100644 --- a/saveweb-search-backend.py +++ b/saveweb-search-backend.py @@ -13,8 +13,8 @@ import meilisearch_python_sdk.errors MEILI_KEY = os.getenv('MEILI_KEY', '') print('$MEILI_KEY', 'set' if MEILI_KEY else 'not set') -MEILI_HOST = os.getenv('MEILI_HOST', 'http://127.0.0.1:7700') -print('$MEILI_HOST', MEILI_HOST) +MEILI_URL = os.getenv('MEILI_URL', 'http://127.0.0.1:7700') +print('$MEILI_URL', MEILI_URL) STWP_SEARCH_MAX_LOAD = float(os.getenv('STWP_SEARCH_MAX_LOAD')) if os.getenv('STWP_SEARCH_MAX_LOAD') else ( os.cpu_count() / 1.5 if os.cpu_count() else 1.5 ) @@ -94,7 +94,7 @@ def ops_limiter(func): return wrapper -client = meilisearch_python_sdk.AsyncClient(MEILI_HOST, MEILI_KEY) +client = meilisearch_python_sdk.AsyncClient(MEILI_URL, MEILI_KEY) @app.get('/api/')