diff options
author | Bin Yang <bin.yang@windriver.com> | 2019-04-11 05:48:32 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-11 05:48:32 +0000 |
commit | 433bb010c15d30f3b6054a443802c29945f94982 (patch) | |
tree | e99c05576b448c76c0da06136298bde1a36dffa3 /src/k8splugin/cmd | |
parent | ebc64fad1d60f14c607db0930f2c5350f622973d (diff) | |
parent | 905a39c8011295ee4b290681f0fda6ca753b7ae3 (diff) |
Merge "Add option to start https listener"
Diffstat (limited to 'src/k8splugin/cmd')
-rw-r--r-- | src/k8splugin/cmd/main.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/k8splugin/cmd/main.go b/src/k8splugin/cmd/main.go index e600c0d6..53b6ab17 100644 --- a/src/k8splugin/cmd/main.go +++ b/src/k8splugin/cmd/main.go @@ -24,6 +24,7 @@ import ( "k8splugin/api" utils "k8splugin/internal" + "k8splugin/internal/auth" "github.com/gorilla/handlers" ) @@ -55,5 +56,13 @@ func main() { close(connectionsClose) }() - log.Fatal(httpServer.ListenAndServe()) + tlsConfig, err := auth.GetTLSConfig("ca.cert", "server.cert", "server.key") + if err != nil { + log.Println("Error Getting TLS Configuration. Starting without TLS...") + log.Fatal(httpServer.ListenAndServe()) + } else { + httpServer.TLSConfig = tlsConfig + // empty strings because tlsconfig already has this information + err = httpServer.ListenAndServeTLS("", "") + } } |