Skip to content

Commit

Permalink
Feat/update (#23)
Browse files Browse the repository at this point in the history
* Update docs and env vars
* Update requirements
  • Loading branch information
tarsil authored Mar 7, 2024
1 parent 4f2a520 commit 6378e46
Show file tree
Hide file tree
Showing 3 changed files with 12 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
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

0 comments on commit 6378e46

Please sign in to comment.