Skip to content

Commit 310d806

Browse files
rustyrussellcdecker
authored andcommitted
plugins: document and extend the ~/.lightning/plugins/ dir.
Load any plugins directly as well as subdirs. Signed-off-by: Rusty Russell <[email protected]>
1 parent 4f937ea commit 310d806

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Changed
1616

1717
- build: now requires `python3-mako` to be installed, i.e. `sudo apt-get install python3-mako`
18+
- plugins: if the config directory has a `plugins` subdirectory, those are loaded.
1819
- plugins: a new notification type `invoice_payment` (sent when an invoice is paid) has been added
1920
- plugins: a new 'channel_opened' notification type is added, which is emitted when a peer succesfully funds a channel to us
2021
- rpc: a new rpc command is added, `plugin`. It allows one to manage plugins without restarting `lightningd`.

doc/lightningd-config.5

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
.\" Title: lightningd-config
33
.\" Author: [see the "AUTHOR" section]
44
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
5-
.\" Date: 06/30/2019
5+
.\" Date: 07/29/2019
66
.\" Manual: \ \&
77
.\" Source: \ \&
88
.\" Language: English
99
.\"
10-
.TH "LIGHTNINGD\-CONFIG" "5" "06/30/2019" "\ \&" "\ \&"
10+
.TH "LIGHTNINGD\-CONFIG" "5" "07/29/2019" "\ \&" "\ \&"
1111
.\" -----------------------------------------------------------------
1212
.\" * Define some portability stuff
1313
.\" -----------------------------------------------------------------
@@ -455,7 +455,7 @@ to authenticate to the Tor control port\&.
455455
.RE
456456
.SS "Lightning Plugins"
457457
.sp
458-
lightningd(8) supports plugins, which offer additional configuration options and JSON\-RPC methods, depending on the plugin\&. Some are supplied by default (usually located in \fBlibexec/c\-lightning/plugins/\fR), but you can add your own, too\&.
458+
lightningd(8) supports plugins, which offer additional configuration options and JSON\-RPC methods, depending on the plugin\&. Some are supplied by default (usually located in \fBlibexec/c\-lightning/plugins/\fR)\&. If a \fBplugins\fR directory exists under \fIlightning\-dir\fR that is searched for plugins along with any immediate subdirectories)\&. You can specify additional paths too:
459459
.PP
460460
\fBplugin\fR=\fIPATH\fR
461461
.RS 4

doc/lightningd-config.5.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ Lightning Plugins
328328
lightningd(8) supports plugins, which offer additional configuration
329329
options and JSON-RPC methods, depending on the plugin. Some are
330330
supplied by default (usually located in
331-
*libexec/c-lightning/plugins/*), but you can add your own, too.
331+
*libexec/c-lightning/plugins/*). If a *plugins* directory exists
332+
under 'lightning-dir' that is searched for plugins along with
333+
any immediate subdirectories). You can specify additional paths too:
332334

333335
*plugin*='PATH'::
334336
Specify a plugin to run as part of c-lightning. This can be specified

lightningd/plugin.c

+3
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,9 @@ void plugins_add_default_dir(struct plugins *plugins, const char *default_dir)
909909
DIR *d = opendir(default_dir);
910910
if (d) {
911911
struct dirent *di;
912+
913+
/* Add this directory itself, and recurse down once. */
914+
add_plugin_dir(plugins, default_dir, true);
912915
while ((di = readdir(d)) != NULL) {
913916
if (streq(di->d_name, ".") || streq(di->d_name, ".."))
914917
continue;

0 commit comments

Comments
 (0)