#include <haproxy/filters.h>
#include <haproxy/global.h>
#include <haproxy/hlua.h>
+#include <haproxy/hstream.h>
#include <haproxy/http_rules.h>
#include <haproxy/limits.h>
#if defined(USE_LINUX_CAP)
int pidfd = -1; /* FD to keep PID */
int daemon_fd[2] = {-1, -1}; /* pipe to communicate with parent process */
int devnullfd = -1;
+int httpterm_mode;
+struct cfgfile httpterm_cfg;
static int stopped_tgroups;
static int stop_detected;
exit(EXIT_FAILURE);
}
+ httpterm_mode = !strncmp(progname, "httpterm", strlen("httpterm"));
chunk_initlen(&global.log_tag, strdup(progname), len, len);
}
exit(EXIT_FAILURE);
}
+ if (httpterm_mode)
+ return;
+
/* skip program name and start */
argc--; argv++;
while (argc > 0) {
RUN_INITCALLS(STG_INIT);
+ if (httpterm_mode)
+ init_httpterm_cfg(argc, argv, &httpterm_cfg);
+
/* Late init step: SSL crypto libs init and check, Lua lib init, ACL init,
* set modes from cmdline and change dir, if this option is provided via
* cmdline.
/* backup initial process env, because parse_cfg() could modify it with
* setenv/unsetenv/presetenv/resetenv keywords.
*/
- if (backup_env() != 0)
+ if (!httpterm_mode && backup_env() != 0)
exit(EXIT_FAILURE);
- /* parse conf in discovery mode and set modes from config */
- read_cfg_in_discovery_mode(argc, argv);
+ if (!httpterm_mode)
+ /* parse conf in discovery mode and set modes from config */
+ read_cfg_in_discovery_mode(argc, argv);
+ else
+ parse_cfg(&httpterm_cfg);
/* From this stage all runtime modes are known. So let's do below some
* preparation steps and then let's apply all discovered modes.
}
/* Worker, daemon, foreground modes read the rest of the config */
- if (!master) {
+ if (!master && !httpterm_mode) {
usermsgs_clr("config");
if (global.mode & MODE_MWORKER) {
if (clean_env() != 0) {