Skip to content

Commit 4d676a3

Browse files
committed
BUG/MINOR: CR: fix redundant RuntimeAPI field in Global CR
1 parent a5ded8a commit 4d676a3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

controller/configuration/defaults.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ func SetGlobal(global *models.Global, env Env) {
1414
global.Localpeer = "local"
1515
global.ServerStateBase = env.StateDir
1616
global.ServerStateFile = "global"
17-
global.RuntimeAPIs = append(global.RuntimeAPIs, &models.RuntimeAPI{
17+
runtimeAPIs := []*models.RuntimeAPI{{
1818
Address: &env.RuntimeSocket,
1919
ExposeFdListeners: true,
2020
Level: "admin",
21-
})
21+
}}
22+
if len(global.RuntimeAPIs) == 0 {
23+
global.RuntimeAPIs = runtimeAPIs
24+
} else if *(global.RuntimeAPIs[0].Address) != env.RuntimeSocket {
25+
global.RuntimeAPIs = append(runtimeAPIs, global.RuntimeAPIs...)
26+
}
2227
// Default values
2328
if global.Daemon == "" {
2429
global.Daemon = "enabled"

0 commit comments

Comments
 (0)