-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add optional callback-style way to resolve secret values from config #111
base: main
Are you sure you want to change the base?
Conversation
DIS-A-POINTED!
EVEN MORE DIS-A-POINTED!
@@ -194,7 +199,13 @@ def get(self, | |||
return as_type(value) | |||
elif isinstance(value, Mapping): | |||
# wrap value in a Configuration | |||
return self._wrap(value) | |||
value = self._wrap(value) | |||
if self._secrets and self._secrets.matches(value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB: this gets called every step along the config.deeply.nested.keys.foobar
way; matches()
needs to be cheap 😬
@@ -194,7 +199,13 @@ def get(self, | |||
return as_type(value) | |||
elif isinstance(value, Mapping): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this has been hooked into here: current implementation requires any and all implementations to utilize at least some kind of mapping / dict / subtree to implement this. Do we want this kind restriction? Do we want to implement any alternatives right away or maybe at a later stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, yes, this need many comments on what / why the f things are as they are, soon™
callback=callback, | ||
single_key=single_key, | ||
args=args, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very composition over inheritance approach to an implementation conforming to the Secrets
protocol above, is this too much? 🤔
def merge(*sources: typing.Mapping[str, typing.Any], missing: typing.Any = None) -> 'Configuration': | ||
def merge(*sources: typing.Mapping[str, typing.Any], | ||
missing: typing.Any = None, | ||
secrets: typing.Any = None) -> 'Configuration': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mypy fails to infer the set being constructed below correctly when this is set to typing.Optional[Secrets]
, meh 🤔
Designed to let
keyring.get_password
drop into anyload*
function orConfiguration
instance, currently based on resolved a sing-magic-key mapping in to a secret value, resolved from the keys inside the mapping: