-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Checks
- I added a descriptive title to this issue
- I have searched (google, github) for similar issues and couldn't find anything
- I have read and followed the docs and still think this is a bug
Bug
To reproduce, on Linux OS:
- build a config manager that subclasses
BaseSettings - add
secrets_dirconfig pointing to dir with text file(s), as per docs - add class attributes to use the files in
secrets_dir, as per docs - run the code and inspect/print the attributes
- observe that vars coming from .env file work fine, but those from
secrets_dirare None, or error if not Optional, and there is no user warning for thesecrets_diritself
Repeat the same on MacOS - it should work OK, the content is read correctly.
I have added a repo with Dockerfile replicating the setup: https://github.com/dimitri-b/pydantic-secrets-dir-issue
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.8.2
pydantic compiled: True
install path: /usr/local/lib/python3.8/site-packages/pydantic
python version: 3.8.12 (default, Sep 3 2021, 02:35:42) [GCC 8.3.0]
platform: Linux-5.10.47-linuxkit-x86_64-with-glibc2.2.5
optional deps. installed: ['dotenv', 'typing-extensions']
import pydantic
class SettingsLocal(pydantic.BaseSettings):
NORMAL_VAR: Optional[str]
SECRET_VAR: Optional[str]
class Config:
env_file = "./.env"
secrets_dir = "./secrets-in-project"
...Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X