Skip to content

Commit 0b1618e

Browse files
prometherionaiharos
authored andcommitted
BUG/MEDIUM: injected configuration file can be used for userlist too
We faced the scenario where a userlist and configuration are the same file, preventing Dataplane API to start when initialized using the HAProxy `program` directive.
1 parent 68bd22b commit 0b1618e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

configure_data_plane.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,25 @@ func configureAPI(api *operations.DataPlaneAPI) http.Handler {
144144

145145
if cfgFiles := os.Getenv("HAPROXY_CFGFILES"); cfgFiles != "" {
146146
m := map[string]bool{"configuration": false}
147-
148147
if len(haproxyOptions.UserListFile) > 0 {
149148
m["userlist"] = false
150149
}
150+
151151
for _, f := range strings.Split(cfgFiles, ";") {
152+
var conf bool
153+
var user bool
154+
152155
if f == haproxyOptions.ConfigFile {
156+
conf = true
153157
m["configuration"] = true
154-
continue
155158
}
156159
if len(haproxyOptions.UserListFile) > 0 && f == haproxyOptions.UserListFile {
160+
user = true
157161
m["userlist"] = true
158-
continue
159162
}
160-
log.Warningf("The configuration file %s in HAPROXY_CFGFILES is not defined, neither by --config-file or --userlist-file flags.", f)
163+
if !conf && !user {
164+
log.Warningf("The configuration file %s in HAPROXY_CFGFILES is not defined, neither by --config-file or --userlist-file flags.", f)
165+
}
161166
}
162167
for f, ok := range m {
163168
if !ok {

0 commit comments

Comments
 (0)