diff --git a/changes/1105-tribals.md b/changes/1105-tribals.md new file mode 100644 index 0000000..ee40cf3 --- /dev/null +++ b/changes/1105-tribals.md @@ -0,0 +1 @@ +docs: Fix explanation of case sensitive environment variable names when populating `BaseSettings` subclass attributes. diff --git a/docs/usage/settings.md b/docs/usage/settings.md index b23188f..77b79eb 100644 --- a/docs/usage/settings.md +++ b/docs/usage/settings.md @@ -50,8 +50,11 @@ Case-sensitivity can be turned on through the `Config`: {!.tmp_examples/settings_case_sensitive.py!} ``` -When `case_sensitive` is `True`, the environment variable must be in all-caps, -so in this example `redis_host` could only be modified via `export REDIS_HOST`. +When `case_sensitive` is `True`, the environment variable names must match field names (optionally with a prefix), +so in this example +`redis_host` could only be modified via `export redis_host`. If you want to name environment variables +all upper-case, you should name attribute all upper-case too. You can still name environment variables anything +you like through `Field(..., env=...)`. !!! note On Windows, python's `os` module always treats environment variables as case-insensitive, so the