listconfigs: show plugin options in 'configs' with normal options.

This integrates them with configvars properly: they almost "just work"
in listconfigs now, and we don't put them in a special sub-object
under their plugin.

Unfortunately, this means `listconfigs` now has a loose schema: any
plugin can add something to it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Plugins: reloaded plugins get passed any vars from configuration files.
Changelog-Deprecated: Config: boolean plugin options set to `1` or `0` (use `true` and `false` like non-plugin options).
This commit is contained in:
Rusty Russell
2023-06-02 12:06:04 +09:30
parent 1b252f349f
commit 9cb2b2f13a
8 changed files with 320 additions and 246 deletions

View File

@@ -1617,7 +1617,7 @@ static const char *init(struct plugin *p, const char *buf UNUSED,
rpc_scan(p, "listconfigs",
take(json_out_obj(NULL, "config", "experimental-offers")),
"{experimental-offers:%}",
"{configs:{experimental-offers:{set:%}}}",
JSON_SCAN(json_to_bool, &exp_offers));
if (!exp_offers)

View File

@@ -1050,7 +1050,9 @@ static const char *init(struct plugin *p,
rpc_scan(p, "listconfigs",
take(json_out_obj(NULL, NULL, NULL)),
"{cltv-final:%,experimental-offers:%}",
"{configs:"
"{cltv-final:{value_int:%},"
"experimental-offers:{set:%}}}",
JSON_SCAN(json_to_u16, &cltv_final),
JSON_SCAN(json_to_bool, &offers_enabled));

View File

@@ -582,7 +582,9 @@ static const char *init(struct plugin *p,
rpc_scan(p, "listconfigs",
take(json_out_obj(NULL, NULL, NULL)),
"{max-locktime-blocks:%,experimental-offers:%}",
"{configs:"
"{max-locktime-blocks:{value_int:%},"
"experimental-offers:{set:%}}}",
JSON_SCAN(json_to_number, &maxdelay_default),
JSON_SCAN(json_to_bool, &exp_offers));