Merge ListenAndServe and ListenAndServeTLS for simplification purpose (#3186)

This commit is contained in:
Anis Elleuch
2016-11-06 04:32:13 +01:00
committed by Harshavardhana
parent 1105508453
commit 754c0770d6
3 changed files with 42 additions and 66 deletions

View File

@@ -487,12 +487,11 @@ func serverMain(c *cli.Context) {
// Start server, automatically configures TLS if certs are available.
go func(tls bool) {
var lerr error
cert, key := "", ""
if tls {
lerr = apiServer.ListenAndServeTLS(mustGetCertFile(), mustGetKeyFile())
} else {
// Fallback to http.
lerr = apiServer.ListenAndServe()
cert, key = mustGetCertFile(), mustGetKeyFile()
}
lerr = apiServer.ListenAndServe(cert, key)
fatalIf(lerr, "Failed to start minio server.")
}(tls)