Skip to content

Commit e3c39ef

Browse files
Fix error on enabled insecure mode
1 parent 9952e88 commit e3c39ef

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

service.go

+10-5
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,20 @@ func (s *Service) Serve() error {
124124
panic(err)
125125
}
126126

127+
tlsConfig := tls.Config{
128+
NextProtos: []string{"h2"},
129+
InsecureSkipVerify: s.enableInsecure,
130+
}
131+
127132
cert, err := s.GetCertificate()
128133
if err != nil {
129-
return err
134+
if !s.enableInsecure {
135+
return err
136+
}
130137
}
131138

132-
tlsConfig := tls.Config{
133-
Certificates: []tls.Certificate{cert},
134-
NextProtos: []string{"h2"},
135-
InsecureSkipVerify: s.enableInsecure,
139+
if !s.enableInsecure {
140+
tlsConfig.Certificates = []tls.Certificate{cert}
136141
}
137142

138143
tlsConfig.BuildNameToCertificate()

0 commit comments

Comments
 (0)