mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
docs: Fix explanation of case sensitivity for Settings (#1110)
* docs: Fix explanation of case sensitivity for `Settings` * Add changes * Update docs/usage/settings.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * Update docs/usage/settings.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * Update docs/usage/settings.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
docs: Fix explanation of case sensitive environment variable names when populating `BaseSettings` subclass attributes.
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user