lightningd: listconfigs update, using configvars code.

listconfigs is convenient, but it doesn't handle multi-options well: it
outputs an object with duplicate fields in this case (e.g. log-file), nor
is it extensible to show more than raw values.

However, listconfigs doesn't do what other list commands do (use a
sub-object "configs") so we can put the new values under that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listconfigs` now has `configs` subobject with more information about each config option.
This commit is contained in:
Rusty Russell
2023-06-02 12:06:04 +09:30
parent f1e994a095
commit b9270c564a
6 changed files with 1746 additions and 12 deletions

View File

@@ -741,11 +741,16 @@ def test_listconfigs(node_factory, bitcoind, chainparams):
# Test one at a time.
for c in configs.keys():
if c.startswith('#') or c.startswith('plugins') or c == 'important-plugins':
if c.startswith('#') or c.startswith('plugins') or c == 'important-plugins' or c == 'configs':
continue
oneconfig = l1.rpc.listconfigs(config=c)
assert(oneconfig[c] == configs[c])
# Test modern ones!
for c in configs['configs'].keys():
oneconfig = l1.rpc.listconfigs(config=c)['configs']
assert(oneconfig[c] == configs['configs'][c])
def test_listconfigs_plugins(node_factory, bitcoind, chainparams):
l1 = node_factory.get_node()