-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels