Move the main configfile structure into configfile.c

This is required for a later refactoring of the configuration file
handling.
This commit is contained in:
Ian Barwick
2020-05-04 11:19:13 +09:00
parent 3ca642fee1
commit d37513312a
6 changed files with 11 additions and 14 deletions

View File

@@ -33,6 +33,7 @@ const static char *_progname = NULL;
char config_file_path[MAXPGPATH] = ""; char config_file_path[MAXPGPATH] = "";
static bool config_file_provided = false; static bool config_file_provided = false;
bool config_file_found = false; bool config_file_found = false;
t_configuration_options config_file_options = T_CONFIGURATION_OPTIONS_INITIALIZER;
static void parse_config(t_configuration_options *options, bool terse); static void parse_config(t_configuration_options *options, bool terse);
static void _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *warning_list); static void _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *warning_list);

View File

@@ -191,6 +191,11 @@ typedef struct
int promote_delay; int promote_delay;
} t_configuration_options; } t_configuration_options;
/* Declare the main configfile structure for client applications */
extern t_configuration_options config_file_options;
/* /*
* The following will initialize the structure with a minimal set of options; * The following will initialize the structure with a minimal set of options;
* actual defaults are set in parse_config() before parsing the configuration file * actual defaults are set in parse_config() before parsing the configuration file

View File

@@ -240,19 +240,16 @@ typedef struct ColHeader
/* global configuration structures */ /* globally available configuration structures */
extern t_runtime_options runtime_options; extern t_runtime_options runtime_options;
extern t_configuration_options config_file_options; extern t_conninfo_param_list source_conninfo;
extern t_node_info target_node_info;
t_conninfo_param_list source_conninfo;
/* global variables */
extern bool config_file_required; extern bool config_file_required;
extern char pg_bindir[MAXLEN]; extern char pg_bindir[MAXLEN];
extern t_node_info target_node_info; /* global functions */
extern int check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *server_version_string); extern int check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *server_version_string);
extern void check_93_config(void); extern void check_93_config(void);
extern bool create_repmgr_extension(PGconn *conn); extern bool create_repmgr_extension(PGconn *conn);

View File

@@ -75,7 +75,6 @@
* ============================ */ * ============================ */
t_runtime_options runtime_options = T_RUNTIME_OPTIONS_INITIALIZER; t_runtime_options runtime_options = T_RUNTIME_OPTIONS_INITIALIZER;
t_configuration_options config_file_options = T_CONFIGURATION_OPTIONS_INITIALIZER;
/* conninfo params for the node we're operating on */ /* conninfo params for the node we're operating on */
t_conninfo_param_list source_conninfo = T_CONNINFO_PARAM_LIST_INITIALIZER; t_conninfo_param_list source_conninfo = T_CONNINFO_PARAM_LIST_INITIALIZER;

View File

@@ -39,13 +39,9 @@ static bool daemonize = true;
static bool show_pid_file = false; static bool show_pid_file = false;
static bool no_pid_file = false; static bool no_pid_file = false;
t_configuration_options config_file_options = T_CONFIGURATION_OPTIONS_INITIALIZER;
t_node_info local_node_info = T_NODE_INFO_INITIALIZER; t_node_info local_node_info = T_NODE_INFO_INITIALIZER;
PGconn *local_conn = NULL; PGconn *local_conn = NULL;
/* Collate command line errors here for friendlier reporting */ /* Collate command line errors here for friendlier reporting */
static ItemList cli_errors = {NULL, NULL}; static ItemList cli_errors = {NULL, NULL};

View File

@@ -17,7 +17,6 @@ extern volatile sig_atomic_t got_SIGHUP;
extern MonitoringState monitoring_state; extern MonitoringState monitoring_state;
extern instr_time degraded_monitoring_start; extern instr_time degraded_monitoring_start;
extern t_configuration_options config_file_options;
extern t_node_info local_node_info; extern t_node_info local_node_info;
extern PGconn *local_conn; extern PGconn *local_conn;
extern bool startup_event_logged; extern bool startup_event_logged;