lightningd: annotate configuration settings which contain JSON literals.

We have hacky code to show some listconfigs values as literals; instead
explicitly encode the types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-06-02 12:06:04 +09:30
parent 86abb4c4bd
commit 8281008b08
4 changed files with 97 additions and 69 deletions

View File

@@ -347,10 +347,11 @@ struct configvar **initial_config_opts(const tal_t *ctx,
opt_register_version();
/* For convenience, we set deprecated_apis and rpc_filename now, too */
opt_register_early_arg("--allow-deprecated-apis",
opt_set_bool_arg, opt_show_bool,
&deprecated_apis,
"Enable deprecated options, JSONRPC commands, fields, etc.");
clnopt_witharg("--allow-deprecated-apis",
OPT_EARLY|OPT_SHOWBOOL,
opt_set_bool_arg, opt_show_bool,
&deprecated_apis,
"Enable deprecated options, JSONRPC commands, fields, etc.");
/* Allow them to override rpc-file too. */
*rpc_filename = default_rpcfile(ctx);

View File

@@ -52,6 +52,12 @@ struct configvar {
#define OPT_DEV (1 << (OPT_USER_START+1))
/* Doesn't return, so don't show in listconfigs */
#define OPT_EXITS (1 << (OPT_USER_START+2))
/* listconfigs should treat as a literal number */
#define OPT_SHOWINT (1 << (OPT_USER_START+3))
/* listconfigs should treat as a literal msat number */
#define OPT_SHOWMSATS (1 << (OPT_USER_START+4))
/* listconfigs should treat as a literal boolean `true` or `false` */
#define OPT_SHOWBOOL (1 << (OPT_USER_START+5))
/* Use this instead of opt_register_*_arg if you want OPT_* from above */
#define clnopt_witharg(names, type, cb, show, arg, desc) \