]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: init: setenv HAPROXY_CFGFILES
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 20 May 2019 09:15:37 +0000 (11:15 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 20 May 2019 09:21:00 +0000 (11:21 +0200)
Set the HAPROXY_CFGFILES environment variable which contains the list of
configuration files used to start haproxy, separated by semicolon.

src/haproxy.c

index a47b7dd32ffe6f9b25a30a3c374f6e69dcd9dcfd..dcb515da44d08ab27086033dc7e2686337d02065 100644 (file)
@@ -1571,6 +1571,7 @@ static void init(int argc, char **argv)
 
        /* in wait mode, we don't try to read the configuration files */
        if (!(global.mode & MODE_MWORKER_WAIT)) {
+               struct buffer *trash = get_trash_chunk();
 
                /* handle cfgfiles that are actually directories */
                cfgfiles_expand_directories();
@@ -1582,6 +1583,11 @@ static void init(int argc, char **argv)
                list_for_each_entry(wl, &cfg_cfgfiles, list) {
                        int ret;
 
+                       if (trash->data)
+                               chunk_appendf(trash, ";");
+
+                       chunk_appendf(trash, "%s", wl->s);
+
                        ret = readcfgfile(wl->s);
                        if (ret == -1) {
                                ha_alert("Could not open configuration file %s : %s\n",
@@ -1603,6 +1609,9 @@ static void init(int argc, char **argv)
                        ha_alert("Fatal errors found in configuration.\n");
                        exit(1);
                }
+               if (trash->data)
+                       setenv("HAPROXY_CFGFILES", trash->area, 1);
+
        }
        if (global.mode & MODE_MWORKER) {
                int proc;