-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Support more than one directory for settings management #3
Comments
Thanks, looks reasonable to me 👍. |
May I throw in 2¢ – perhaps a more flexible approach would be to expose sources as a from pydantic_settings import default_sources, BaseSettings
class Settings(BaseSettings):
my_secret_data: str
class Config:
sources = [
*default_sources,
SecretsSettingsSource('/run/config'),
SecretsSettingsSource('/run/secrets'),
] This would need some changes in how settings sources are initialized (I think we can pass As an upside, it will allow specifying third-party sources more easily: class Config:
sources = [*default_sources, MyFeatureFlagsProviderSource(...)] |
I'd also second that sources should be configurable via |
Please take a look at the package that I'm going to use in production, it implements this feature: |
Added in 12d85cf |
very similar to pydantic/pydantic#2284
I would love to be able to leverage built-in settings configuration, but in order to do that, I need support for both ConfigMaps and Secrets
i don't know if a file per setting is absolutely necessary, but it would be great if instead of a
secrets_dir: str|None
you had adirectories: List[str]|None
orsearch_dirs: List[str]|None
argument, where settings were loaded by iterating over 1..N directories using much the same logic as today.beyond just allowing use of both ConfigMaps and Secrets, this could then produce conflicts, which instead of a defect, would actually be a very handy a feature, it allows for overrides (such as when running locally) this can be accomplished by having the expectation that the last found match wins.
with files
pragmatic expectation:
all 4 files get opened/read/parsed/validated
resulting object is
The text was updated successfully, but these errors were encountered: