You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I'm looking for is for a way to make it so that if CONFIG_FILE is not set, fallback to config.toml. Right now file is prioritized, then env, then cl. There should probably be a Value error thrown if more than one of the flags are truthy? As they can not work together?
For me, it seems the fix can be as simple as swapping the elif with if statements, and making from env and from cl mutually exclusive, for example? Or make the params order sensitive somehow?
Alternatives:
Having multiple file sources all marked as optional seems like a bit of an iffy approach? As we end up with either a validation error or an empty object I need to check, instead some error regarding resolution.
In this scenario, neither CONFIG_FILE is set and config.toml is available. We then end up with a pydantic validation error instead on any loading related error.
The text was updated successfully, but these errors were encountered:
Thanks for the detailed description! I agree, it would be useful to have a "default value" for the config file path, if no env-var / cli-arg is provided.
I think it would be a bit more work than just swapping the elif with if; we end up with quite a bit of cases. But also not too complicated I guess.
Code:
What I'm looking for is for a way to make it so that if CONFIG_FILE is not set, fallback to config.toml. Right now file is prioritized, then env, then cl. There should probably be a Value error thrown if more than one of the flags are truthy? As they can not work together?
ConfZ/confz/loaders/file_loader.py
Lines 21 to 32 in ecd5b0b
For me, it seems the fix can be as simple as swapping the elif with if statements, and making from env and from cl mutually exclusive, for example? Or make the params order sensitive somehow?
Alternatives:
Having multiple file sources all marked as optional seems like a bit of an iffy approach? As we end up with either a validation error or an empty object I need to check, instead some error regarding resolution.
Example:
In this scenario, neither CONFIG_FILE is set and config.toml is available. We then end up with a pydantic validation error instead on any loading related error.
The text was updated successfully, but these errors were encountered: