Skip to content

Commit

Permalink
Update docs and env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Mar 7, 2024
1 parent 4f2a520 commit 0a3280c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
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
2 changes: 1 addition & 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 Down

0 comments on commit 0a3280c

Please sign in to comment.