New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Providing only one nested value from environment variable #888
Comments
Yeah this seems like a good feature request to me. I've never tried nesting BaseSettings classes but it seems totally reasonable to me and I don't see any reason it shouldn't work like this. (But maybe @samuelcolvin does?) Could you produce a failing test case or two as a starting point for implementation work? |
Sounds good to me. Do you want to use dot notation e.g. Also should this work for dictionaries too? This isn't required for v1 since it would be entirely backwards compatible. |
It's great to hear! I think the only logic that needs to change is merging of Should I start a merge request with the changes and tests or would you like to tackle this one yourselves? |
@idmitrievsky It would be great if you could start a pull request for this. Your approach to the logic sounds right to me (though admittedly there could be some edge cases I'm not considering). |
I've been playing with nested settings for a bit, and I wonder if something similar could be done between environment variables and a Is this the intended behavior, or could the solution discussed here be extended to that case as well (while maintaining the priority order described in the docs)? |
Feature Request
import sys; print(sys.version)
: 3.6.8 (default, Jun 24 2019, 16:49:13) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)]import pydantic; print(pydantic.VERSION)
: 1.0b2Hello, great work on the library! I can't find the reason, why environment variables don't work in nested settings. I have a class
and I want to specify
password
as an environment variablebut pass other fields in as values in code. Right now
BaseSettings
does simple top-level merging of dictionaries that doesn't consider nested valuesbut dictionaries could be merged recursively, so users could provide values for any of their settings in environment variables.
What do you think, would it be useful?
The text was updated successfully, but these errors were encountered: