Skip to content
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

feat: set arbitrary plugin config value at cli #1347

Merged

Conversation

dbluhm
Copy link
Contributor

@dbluhm dbluhm commented Aug 11, 2021

Doing a bit of spit balling.

We previously addressed the need for supplying configuration to plugins with the --plugin-config flag to load a yaml file into settings for use by plugins. We've found this feature to be quite helpful, especially in the case of loading multiple plugins (i.e. resolvers) that each require their own configuration. However, we have also found that it would be handy to be able to set or modify these values from the command line. So instead of having to modify the plugin_config.yml you're using to load the universal resolver plugin to point it to a different resolver instance, we could have a command line argument like the following:

--plugin-config-value http_uniresolver.endpoint=http://localhost:3000

Or perhaps a short form of:

-o http_uniresolver.endpoint=http://localhost:3000

With such a command line argument, we propose that dotted key values act as a shorthand for nesting values. For example, a.b.c.d=value becomes {"a": {"b": {"c": {"d": "value"}}}}. We also propose that the value be loaded as yaml to avoid parsing ourselves while still allowing us to express values more complicated than just strings and numbers.

Open to thoughts 🙂

@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2021

Codecov Report

Merging #1347 (4f9b732) into main (1f8eeb0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1347   +/-   ##
=======================================
  Coverage   95.43%   95.43%           
=======================================
  Files         476      476           
  Lines       28977    28988   +11     
=======================================
+ Hits        27653    27664   +11     
  Misses       1324     1324           

burdettadam
burdettadam previously approved these changes Aug 11, 2021
@andrewwhitehead
Copy link
Contributor

Seems reasonable to me, can you write something like --plugin-config-value "a.b.c=[one,two]" ?

@dbluhm
Copy link
Contributor Author

dbluhm commented Aug 11, 2021

Yep, [one, two], {inline: yaml_dict}, true, etc. all get parsed into the expected values

@andrewwhitehead andrewwhitehead merged commit 9541edf into openwallet-foundation:main Aug 11, 2021
@dbluhm dbluhm deleted the feature/plugin-config-cli branch September 17, 2022 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants