Default value for missing environment variables in yaml and ini config files
See original GitHub issueHow could I specify a default value for the missing environment variable in the configuration provider?
For example: pseudo code
config = dependency_injector.providers.Configuration()
config.from_yaml("conf.yml")
print(config.some_key.size) -> will print ${SOME_KEY_SIZE} if envvar is missing
conf file
some_key:
size: ${SOME_KEY_SIZE}
or maybe we could leave such cases with empty/none values? for e.g.
config.some_key.size -> will be None
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Use environment variables in the configuration - Elastic
Each variable reference is replaced at startup by the value of the environment variable. The replacement is case-sensitive and occurs before the YAML...
Read more >Python, application configuration : environment variables, ini ...
In this chapter, how to read (write) configuration data with Python from environment variables, INI files with configparser and YAML files ...
Read more >Using Environment Variables in Python for App Configuration ...
Learn how experienced developers use environment variables in Python, including managing default values and typecasting.
Read more >Load config from file & environment variables in Golang with ...
It can find, load, and unmarshal values from a config file. It supports many types of files, such as JSON, TOML, YAML, ENV,...
Read more >Settings and Environment Variables - FastAPI
If not provided, it's None by default, here we provide "World" as the default value to use. Then you could call that Python...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well, yeah, I agree. I think I can implement it.
Hi @hbmshemet. Yeah, reasonable concern. I’ll check what’s going on in the code.