rename MEILI_HOST to MEILI_URL

This commit is contained in:
yzqzss 2024-02-18 23:42:13 +08:00
parent 2732d7d294
commit 49c5e19dd7
2 changed files with 6 additions and 5 deletions

View File

@ -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.

View File

@ -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/')