diff --git a/cmd/ldap/server.go b/cmd/ldap/server.go index 80b55b988..7b189559e 100644 --- a/cmd/ldap/server.go +++ b/cmd/ldap/server.go @@ -52,11 +52,18 @@ func main() { ex := common.Init() defer common.Defer() + go func() { + for { + <-ex + os.Exit(0) + } + }() ac := ak.NewAPIController(*akURLActual, akToken) if ac == nil { os.Exit(1) } + defer ac.Shutdown() ac.Server = ldap.NewServer(ac) @@ -67,7 +74,5 @@ func main() { for { <-ex - ac.Shutdown() - os.Exit(0) } } diff --git a/cmd/proxy/server.go b/cmd/proxy/server.go index bcf806f32..cd0074405 100644 --- a/cmd/proxy/server.go +++ b/cmd/proxy/server.go @@ -55,11 +55,18 @@ func main() { ex := common.Init() defer common.Defer() + go func() { + for { + <-ex + os.Exit(0) + } + }() ac := ak.NewAPIController(*akURLActual, akToken) if ac == nil { os.Exit(1) } + defer ac.Shutdown() ac.Server = proxyv2.NewProxyServer(ac) @@ -70,7 +77,5 @@ func main() { for { <-ex - ac.Shutdown() - os.Exit(0) } }