lightningd: switch parsing to common/configvar

Now we wire in the code which gathers configvars and parses from there;
lightningd keeps the array of configuration variables for future use.

Note that lightning-cli also needs to read the config, but it has its
own options (including short ones!) and doesn't want to use this
configvar mechanism, so we have a different API for that now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-06-02 12:05:51 +09:30
parent f54e4f3084
commit edbaa944da
20 changed files with 312 additions and 320 deletions

View File

@@ -650,7 +650,7 @@ int main(int argc, char *argv[])
jsmntok_t *toks;
const jsmntok_t *result, *error, *id;
const tal_t *ctx = tal(NULL, char);
char *config_filename, *lightning_dir, *net_dir, *rpc_filename;
char *net_dir, *rpc_filename;
jsmn_parser parser;
int parserr;
enum format format = DEFAULT_FORMAT;
@@ -667,9 +667,8 @@ int main(int argc, char *argv[])
setup_option_allocators();
initial_config_opts(ctx, argc, argv,
&config_filename, &lightning_dir, &net_dir,
&rpc_filename);
opt_exitcode = ERROR_USAGE;
minimal_config_opts(ctx, argc, argv, &net_dir, &rpc_filename);
opt_register_noarg("--help|-h", opt_usage_and_exit,
"<command> [<params>...]", "Show this message. Use the command help (without hyphens -- \"lightning-cli help\") to get a list of all RPC commands");
@@ -695,8 +694,6 @@ int main(int argc, char *argv[])
NULL, &commando,
"Send this as a commando command to nodeid:rune");
opt_register_version();
opt_early_parse(argc, argv, opt_log_stderr_exit_usage);
opt_parse(&argc, argv, opt_log_stderr_exit_usage);