2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_CONFIGDIR_H
|
|
|
|
#define LIGHTNING_COMMON_CONFIGDIR_H
|
2016-01-21 21:11:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/tal/tal.h>
|
|
|
|
|
2023-06-02 04:35:51 +02:00
|
|
|
/* Unless overridden, we exit with status 1 when option parsing fails */
|
|
|
|
extern int opt_exitcode;
|
|
|
|
|
2017-12-13 21:00:24 +01:00
|
|
|
/* Helper for options which are tal() strings. */
|
|
|
|
char *opt_set_talstr(const char *arg, char **p);
|
|
|
|
|
2019-11-23 02:45:53 +01:00
|
|
|
/* Initial options setup */
|
|
|
|
void setup_option_allocators(void);
|
2019-07-25 07:35:36 +02:00
|
|
|
|
2023-06-02 04:35:51 +02:00
|
|
|
/* Minimal config parsing for tools: use opt_early_parse/opt_parse after */
|
|
|
|
void minimal_config_opts(const tal_t *ctx,
|
2019-11-23 02:45:53 +01:00
|
|
|
int argc, char *argv[],
|
2023-08-09 19:10:44 +02:00
|
|
|
char **config_filename,
|
|
|
|
char **basedir,
|
2019-11-23 02:46:40 +01:00
|
|
|
char **config_netdir,
|
2019-11-23 02:45:53 +01:00
|
|
|
char **rpc_filename);
|
|
|
|
|
2023-06-02 04:35:51 +02:00
|
|
|
/* 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. */
|
2023-09-21 07:36:26 +02:00
|
|
|
void parse_configvars_early(struct configvar **cvs, bool developer);
|
2023-06-02 04:35:51 +02:00
|
|
|
|
|
|
|
/* 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,
|
2023-09-21 07:36:26 +02:00
|
|
|
bool full_knowledge, bool developer);
|
2019-11-23 02:45:53 +01:00
|
|
|
|
2019-11-23 02:46:58 +01:00
|
|
|
/* For listconfigs to detect. */
|
|
|
|
bool is_restricted_ignored(const void *fn);
|
|
|
|
bool is_restricted_print_if_nonnull(const void *fn);
|
2016-01-21 21:11:48 +01:00
|
|
|
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_CONFIGDIR_H */
|