that a faulty configuration doesn't prevent the system from booting.
-L <name> : change the local peer name to <name>, which defaults to the local
- hostname. This is used only with peers replication.
+ hostname. This is used only with peers replication. You can use the
+ variable $HAPROXY_LOCALPEER in the configuration file to reference the
+ peer name.
-N <limit> : sets the default per-proxy maxconn to <limit> instead of the
builtin default value (usually 2000). Only useful for debugging.
gethostname(hostname, sizeof(hostname) - 1);
memset(localpeer, 0, sizeof(localpeer));
memcpy(localpeer, hostname, (sizeof(hostname) > sizeof(localpeer) ? sizeof(localpeer) : sizeof(hostname)) - 1);
+ setenv("HAPROXY_LOCALPEER", localpeer, 1);
/*
* Initialize the previously static variables.
case 'n' : cfg_maxconn = atol(*argv); break;
case 'm' : global.rlimit_memmax_all = atol(*argv); break;
case 'N' : cfg_maxpconn = atol(*argv); break;
- case 'L' : strncpy(localpeer, *argv, sizeof(localpeer) - 1); break;
+ case 'L' :
+ strncpy(localpeer, *argv, sizeof(localpeer) - 1);
+ setenv("HAPROXY_LOCALPEER", localpeer, 1);
+ break;
case 'f' :
if (!list_append_word(&cfg_cfgfiles, *argv, &err_msg)) {
ha_alert("Cannot load configuration file/directory %s : %s\n",