Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set meilisearch setting from envoronment variables #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ Source database configuration, currently only support MySQL and PostgreSQL and M

MeiliSearch configuration.

- `api_url`: the MeiliSearch API URL.
- `api_key`: the MeiliSearch API key.
- `api_url`: the MeiliSearch API URL. This can be set from the `MEILI_HTTP_ADDR` environment variable.
- `api_key`: the MeiliSearch API key. This can be set with the `MEILI_MASTER_KEY` environment varable.

### sync

Expand Down
8 changes: 4 additions & 4 deletions meilisync/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional

from pydantic import BaseModel, BaseSettings, Extra
from pydantic import BaseModel, BaseSettings, Extra, Field

from meilisync.enums import ProgressType, SourceType
from meilisync.plugin import load_plugin
Expand All @@ -16,9 +16,9 @@ class Config:
extra = Extra.allow


class MeiliSearch(BaseModel):
api_url: str
api_key: Optional[str]
class MeiliSearch(BaseSettings):
api_url: str = Field(..., env="MEILI_HTTP_ADDR")
api_key: Optional[str] = Field(None, env="MEILI_MASTER_KEY")


class BasePlugin(BaseModel):
Expand Down