diff --git a/docs/settings.md b/docs/settings.md index 24a215b..b21d6b9 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -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 diff --git a/mongoz/conf/__init__.py b/mongoz/conf/__init__.py index 91f6a48..ffb438a 100644 --- a/mongoz/conf/__init__.py +++ b/mongoz/conf/__init__.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 724db0f..395dfaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", ] @@ -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",