File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -252,11 +252,12 @@ func (c *serverConfig) fillTLSConfig(hyConfig *server.Config) error {
252252 if c .TLS .Cert == "" || c .TLS .Key == "" {
253253 return configError {Field : "tls" , Err : errors .New ("empty cert or key path" )}
254254 }
255- cert , err := tls .LoadX509KeyPair (c .TLS .Cert , c .TLS .Key )
256- if err != nil {
257- return configError {Field : "tls" , Err : err }
255+ // Use GetCertificate instead of Certificates so that
256+ // users can update the cert without restarting the server.
257+ hyConfig .TLSConfig .GetCertificate = func (info * tls.ClientHelloInfo ) (* tls.Certificate , error ) {
258+ cert , err := tls .LoadX509KeyPair (c .TLS .Cert , c .TLS .Key )
259+ return & cert , err
258260 }
259- hyConfig .TLSConfig .Certificates = []tls.Certificate {cert }
260261 } else {
261262 // ACME
262263 dataDir := c .ACME .Dir
You can’t perform that action at this time.
0 commit comments