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

lightning-cli plugin start - Assume default relative path #5211

Merged

Conversation

bartobri
Copy link
Contributor

When starting a plugin, if the plugin path cannot be found in
absolute context, assume it is a relative path to the default
plugins dir. As a result, the following now works when my_plugin.py
is installed in the default plugins dir:

lightning-cli plugin start my_plugin.py

Changelog-Added: plugin start RPC subcommand now assumes relative path to default plugins dir if the path is not found in absolute context. i.e. lightning-cli plugin start my_plugin.py

modified:   plugin_control.c

absolute context, assume it is a relative path to the default
plugins dir. As a result, the following now works when my_plugin.py
is installed in the default plugins dir:

lightning-cli plugin start my_plugin.py

Changelog-Added: plugin start RPC subcommand now assumes relative path to default plugins dir if the path is not found in absolute context. i.e. lightning-cli plugin start my_plugin.py

	modified:   plugin_control.c
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK 41409be

Why not, I think this is a good shortcut to load the plugin at runtime, I need to test it locally!

@cdecker
Copy link
Member

cdecker commented May 7, 2022

Notice that there may be more than one --plugin-dir, overriding the default one, so this could be improved to essentially build a PATH with all plugin-dir that have been specified and search in each of them. Not a blocker, but maybe an improvement for another PR?

@rustyrussell
Copy link
Contributor

Yes, I like the idea of searching all plugin dirs. But it's tricky; I don't think we remember them. Perhaps we should just search each dir we found a previous plugin?

Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Minor cleanup, and some documentation would be great!

Thanks!

lightningd/plugin_control.c Outdated Show resolved Hide resolved
In relative path context, use the default plugin path available
at cmd->ld->plugins->default_dir instead of piecing it together
using the lightning basedir and "plugins/".

Also update the plugin documentation to reflect that the use of a
relative path is now available.

Changelog-Added: plugin start RPC subcommand now derives the default plugin dir available via cmd->ld->plugins->default_dir to search for plugins in relative path context. Plugin documentation also updated.

	modified:   doc/lightning-plugin.7.md
	modified:   lightningd/plugin_control.c
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 2181627

@rustyrussell rustyrussell merged commit 24b02c3 into ElementsProject:master Jun 17, 2022
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.

None yet

4 participants