Skip to content

Commit eed09d0

Browse files
committed
BUG/MINOR: configuration: maintain backward compatibility for scheme
1 parent 6596800 commit eed09d0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

dataplaneapi_generated.go renamed to dataplaneapi_configuration.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Code generated by go generate; DO NOT EDIT.
21
// Copyright 2021 HAProxy Technologies
32
//
43
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,9 +25,17 @@ import (
2625
"github.com/haproxytech/dataplaneapi/misc"
2726
)
2827

29-
func SyncWithFileSettings(server *Server, cfg *configuration.Configuration) {
28+
func SyncWithFileSettings(server *Server, cfg *configuration.Configuration) { //nolint: cyclop
3029
configStorage := cfg.GetStorageData()
31-
if configStorage.Dataplaneapi != nil && configStorage.Dataplaneapi.EnabledListeners != nil && !misc.HasOSArg("", "scheme", "") {
30+
// This is added to allow backward compatibility if no scheme is defined it defaults to specification schemes
31+
// and recently we added https to specification for clarity, and then old configs without scheme in them would
32+
// start to fail.
33+
if len(server.EnabledListeners) == 0 && configStorage.Dataplaneapi != nil {
34+
if configStorage.Dataplaneapi.EnabledListeners == nil {
35+
configStorage.Dataplaneapi.EnabledListeners = &[]string{"http"}
36+
}
37+
}
38+
if configStorage.Dataplaneapi.EnabledListeners != nil && !misc.HasOSArg("", "scheme", "") {
3239
server.EnabledListeners = *configStorage.Dataplaneapi.EnabledListeners
3340
}
3441
if configStorage.Dataplaneapi != nil && configStorage.Dataplaneapi.CleanupTimeout != nil && !misc.HasOSArg("", "cleanup-timeout", "") {

0 commit comments

Comments
 (0)