Skip to content

Commit

Permalink
Fix error on enabled insecure mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepartridge committed Aug 16, 2019
1 parent 9952e88 commit e3c39ef
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ func (s *Service) Serve() error {
panic(err)
}

tlsConfig := tls.Config{
NextProtos: []string{"h2"},
InsecureSkipVerify: s.enableInsecure,
}

cert, err := s.GetCertificate()
if err != nil {
return err
if !s.enableInsecure {
return err
}
}

tlsConfig := tls.Config{
Certificates: []tls.Certificate{cert},
NextProtos: []string{"h2"},
InsecureSkipVerify: s.enableInsecure,
if !s.enableInsecure {
tlsConfig.Certificates = []tls.Certificate{cert}
}

tlsConfig.BuildNameToCertificate()
Expand Down

0 comments on commit e3c39ef

Please sign in to comment.