diff options
Diffstat (limited to 'weed/command/master.go')
| -rw-r--r-- | weed/command/master.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/weed/command/master.go b/weed/command/master.go index 6421d321d..8e10d25a2 100644 --- a/weed/command/master.go +++ b/weed/command/master.go @@ -2,6 +2,7 @@ package command import ( "context" + "crypto/tls" "fmt" "net/http" "os" @@ -264,19 +265,20 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) { clientCertFile = viper.GetString("https.master.ca") } - httpS := &http.Server{Handler: r} if masterLocalListener != nil { - go httpS.Serve(masterLocalListener) + go newHttpServer(r, nil).Serve(masterLocalListener) } + var tlsConfig *tls.Config if useMTLS { - httpS.TLSConfig = security.LoadClientTLSHTTP(clientCertFile) + tlsConfig = security.LoadClientTLSHTTP(clientCertFile) + security.FixTlsConfig(util.GetViper(), tlsConfig) } if useTLS { - go httpS.ServeTLS(masterListener, certFile, keyFile) + go newHttpServer(r, tlsConfig).ServeTLS(masterListener, certFile, keyFile) } else { - go httpS.Serve(masterListener) + go newHttpServer(r, nil).Serve(masterListener) } grace.OnInterrupt(ms.Shutdown) |
