mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
plugin: Add listconfigs stub for the --plugin option
This commit is contained in:
@@ -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;
|
||||
@@ -33,3 +35,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.
|
||||
@@ -35,4 +36,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 */
|
||||
|
||||
Reference in New Issue
Block a user