diff --git a/include/types/global.h b/include/types/global.h index fe1085e95..2039e42d1 100644 --- a/include/types/global.h +++ b/include/types/global.h @@ -130,6 +130,7 @@ struct global { struct list logsrvs; char *log_send_hostname; /* set hostname in syslog header */ char *server_state_base; /* path to a directory where server state files can be found */ + char *server_state_file; /* path to the file where server states are loaded from */ struct { int maxpollevents; /* max number of poll events at once */ int maxaccept; /* max number of consecutive accept() */ diff --git a/src/cfgparse.c b/src/cfgparse.c index d3ee13260..c711b2bf1 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -1660,6 +1660,21 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.server_state_base = strdup(args[1]); } + else if (!strcmp(args[0], "server-state-file")) { /* path to the file where HAProxy can load the server states */ + if (global.server_state_file != NULL) { + Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]); + err_code |= ERR_ALERT; + goto out; + } + + if (!*(args[1])) { + Alert("parsing [%s:%d] : '%s' expect one argument: a file path.\n", file, linenum, args[0]); + err_code |= ERR_FATAL; + goto out; + } + + global.server_state_file = strdup(args[1]); + } else if (!strcmp(args[0], "log-tag")) { /* tag to report to syslog */ if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out;