-
Notifications
You must be signed in to change notification settings - Fork 146
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
Pass the name of the property being assigned to the custom coerce function #262
Comments
Hello @mojavelinux. Presently my time is too short to be able to calmly think on issues. So please could you elaborate a bit more: are you requesting approval on a proposed change before submitting the corresponding PR? |
Correct. I am floating the idea before I commit time to implementing it. This feature would be really useful for the project I'm working on that uses convict for config. |
OK. I'll take time to think about it and will report back here. Don't hesitate to invite other active users of convict into the discussion! |
This seems to be a pretty low-impact change because we're simply adding another optional argument for the coerce function to accept. |
Understood. |
I sent a PR. |
I thought coerce function was only to convert value/format not change value depending of dynamic value but this commit is a good hack instead getter (#313). :/ |
Pass the name of the property to which the value is being prepared to the custom coerce function. This will allow the function to look up the old value and append the new value to it instead of overwriting it. This can be useful for config properties that hold a collection of data.
Example:
The main use case for this is binding the config property to an argument that can be specified multiple times from command-line (e.g.,
--attribute key=val
).The text was updated successfully, but these errors were encountered: