Browse Source
plugin: Add listconfigs stub for the --plugin option
plugin-1
Christian Decker
6 years ago
No known key found for this signature in database
GPG Key ID: 1416D83DC4F0E86D
3 changed files with
26 additions and
1 deletions
-
lightningd/options.c
-
lightningd/plugin.c
-
lightningd/plugin.h
|
|
@ -971,7 +971,7 @@ static void add_config(struct lightningd *ld, |
|
|
|
if (ld->proxyaddr) |
|
|
|
answer = fmt_wireaddr(name0, ld->proxyaddr); |
|
|
|
} else if (opt->cb_arg == (void *)opt_add_plugin) { |
|
|
|
/* FIXME: Actually add the plugin options */ |
|
|
|
json_add_opt_plugins(response, ld->plugins); |
|
|
|
#if DEVELOPER |
|
|
|
} else if (strstarts(name, "dev-")) { |
|
|
|
/* Ignore dev settings */ |
|
|
|
|
|
@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
#include <ccan/list/list.h> |
|
|
|
#include <ccan/tal/str/str.h> |
|
|
|
#include <lightningd/json.h> |
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
struct plugin { |
|
|
|
int stdin, stdout; |
|
|
@ -32,3 +34,16 @@ void plugin_register(struct plugins *plugins, const char* path TAKES) |
|
|
|
void plugins_init(struct plugins *plugins) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
void json_add_opt_plugins(struct json_stream *response, |
|
|
|
const struct plugins *plugins) |
|
|
|
{ |
|
|
|
struct plugin *p; |
|
|
|
json_object_start(response, "plugin"); |
|
|
|
for (size_t i=0; i<tal_count(plugins->plugins); i++) { |
|
|
|
p = &plugins->plugins[i]; |
|
|
|
json_object_start(response, p->cmd); |
|
|
|
json_object_end(response); |
|
|
|
} |
|
|
|
json_object_end(response); |
|
|
|
} |
|
|
|
|
|
@ -3,6 +3,7 @@ |
|
|
|
#include "config.h" |
|
|
|
#include <ccan/take/take.h> |
|
|
|
#include <ccan/tal/tal.h> |
|
|
|
#include <lightningd/jsonrpc.h> |
|
|
|
|
|
|
|
/**
|
|
|
|
* A collection of plugins, and some associated information. |
|
|
@ -34,4 +35,13 @@ void plugins_init(struct plugins *plugins); |
|
|
|
*/ |
|
|
|
void plugin_register(struct plugins *plugins, const char* path TAKES); |
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the plugin option and their respective options to listconfigs. |
|
|
|
* |
|
|
|
* This adds a dict that maps the plugin name to a dict of configuration options |
|
|
|
* for the corresponding plugins. |
|
|
|
*/ |
|
|
|
void json_add_opt_plugins(struct json_stream *response, |
|
|
|
const struct plugins *plugins); |
|
|
|
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_PLUGIN_H */ |
|
|
|