Is it in scope for Donfig to mark certain config keys as required? My use case is one where I'd like to require a user to specify some keys as part of their local config (like how Git requires you to configure your user name and email).
Two potential APIs that would work for my use case:
- Insert a sentinel value into defaults
from donfig import Config, required # sentinel value
config = Config(
'my_lib',
defaults = [{
'user': {'name': required, 'name': required},
'foo': {'bar': None},
}]
)
- A separate constructor arg for required keys:
config = Config(
'my_lib',
defaults = [{
'user': {},
'foo': {'bar': None},
}],
required=['user.name', 'user.email']
)
I'd like to raise an error if a user required value is not found in any of the user configs (or environment variables) during setup of the Config class.
Is it in scope for Donfig to mark certain config keys as required? My use case is one where I'd like to require a user to specify some keys as part of their local config (like how Git requires you to configure your user name and email).
Two potential APIs that would work for my use case:
I'd like to raise an error if a user required value is not found in any of the user configs (or environment variables) during setup of the
Configclass.