core-lightning/common/configdir.h
Rusty Russell edbaa944da 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>
2023-06-03 10:50:29 +09:30

47 lines
1.5 KiB
C

#ifndef LIGHTNING_COMMON_CONFIGDIR_H
#define LIGHTNING_COMMON_CONFIGDIR_H
#include "config.h"
#include <ccan/tal/tal.h>
/* Put things we're going to get rid of behind this, so testers can catch
* them early. */
extern bool deprecated_apis;
/* Unless overridden, we exit with status 1 when option parsing fails */
extern int opt_exitcode;
/* Helper for options which are tal() strings. */
char *opt_set_talstr(const char *arg, char **p);
/* Initial options setup */
void setup_option_allocators(void);
/* Minimal config parsing for tools: use opt_early_parse/opt_parse after */
void minimal_config_opts(const tal_t *ctx,
int argc, char *argv[],
char **config_netdir,
char **rpc_filename);
/* Parse initial config options and files */
struct configvar **initial_config_opts(const tal_t *ctx,
int *argc, char *argv[],
bool remove_args,
char **config_filename,
char **config_basedir,
char **config_netdir,
char **rpc_filename);
/* This is called before we know all the options. */
void parse_configvars_early(struct configvar **cvs);
/* This is called once, after we know all the options (if full_knowledge
* is false, ignore unknown non-cmdline options). */
void parse_configvars_final(struct configvar **cvs,
bool full_knowledge);
/* For listconfigs to detect. */
bool is_restricted_ignored(const void *fn);
bool is_restricted_print_if_nonnull(const void *fn);
#endif /* LIGHTNING_COMMON_CONFIGDIR_H */