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

Feat/update #23

Merged
merged 5 commits into from
Mar 7, 2024
Merged
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
8 changes: 4 additions & 4 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ This is exactly what happened.

The way of using the settings object within a Mongoz use of the ORM is via:

* **SETTINGS_MODULE** environment variable.
* **MONGOZ_SETTINGS_MODULE** environment variable.

All the settings are **[Pydantic BaseSettings](https://pypi.org/project/pydantic-settings/)** objects which makes it easier to use and override
when needed.

### SETTINGS_MODULE
### MONGOZ_SETTINGS_MODULE

Mongoz by default uses is looking for a `SETTINGS_MODULE` environment variable to run and
Mongoz by default uses is looking for a `MONGOZ_SETTINGS_MODULE` environment variable to run and
apply the given settings to your instance.

If no `SETTINGS_MODULE` is found, Mongoz then uses its own internal settings which are
If no `MONGOZ_SETTINGS_MODULE` is found, Mongoz then uses its own internal settings which are
widely applied across the system.

#### Custom settings
Expand Down
8 changes: 5 additions & 3 deletions mongoz/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os

if not os.environ.get("SETTINGS_MODULE"):
os.environ.setdefault("SETTINGS_MODULE", "mongoz.conf.global_settings.MongozSettings")
os.environ.setdefault("OVERRIDE_SETTINGS_MODULE_VARIABLE", "MONGOZ_SETTINGS_MODULE")

from dymmond_settings import settings as settings
if not os.environ.get("MONGOZ_SETTINGS_MODULE"):
os.environ.setdefault("MONGOZ_SETTINGS_MODULE", "mongoz.conf.global_settings.MongozSettings")

from dymmond_settings import settings as settings # noqa
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ classifiers = [
]
dependencies = [
"motor>=3.3.1",
"dymmond-settings>=1.0.2",
"dymmond-settings>=1.0.3",
"orjson>=3.9.5",
"pydantic>=2.5.3,<3.0.0",
]
Expand All @@ -55,9 +55,11 @@ Source = "https://github.com/tarsil/mongoz"

[project.optional-dependencies]
test = [
"a2wsgi>1.10.0,<2.0.0",
"autoflake>=2.0.2,<3.0.0",
"black==24.1.1,<25.0",
"esmerald>=2.0.6",
"httpx>=0.25.0,<0.30.0",
"isort>=5.12.0,<6.0.0",
"mypy==1.5.1",
"pytest>=7.2.2,<9.0.0",
Expand Down
Loading