Skip to content

Commit

Permalink
Merge pull request #42 from jboyd01/ssl
Browse files Browse the repository at this point in the history
add ability to run with specified TLS Cert and Key files
  • Loading branch information
pmorie authored Apr 18, 2018
2 parents cfcc33d + 66ffe3f commit 9e13a3b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ func (s *Server) RunTLS(ctx context.Context, addr string, cert string, key strin
return s.run(ctx, addr, listenAndServe)
}

// RunTLSWithTLSFiles creates the HTTPS handler based on the certification
// files that were passed and begins to listen on the specified address.
func (s *Server) RunTLSWithTLSFiles(ctx context.Context, addr string, certFilePath string, keyFilePath string) error {
listenAndServe := func(srv *http.Server) error {
return srv.ListenAndServeTLS(certFilePath, keyFilePath)
}
return s.run(ctx, addr, listenAndServe)
}

func (s *Server) run(ctx context.Context, addr string, listenAndServe func(srv *http.Server) error) error {
glog.Infof("Starting server on %s\n", addr)
srv := &http.Server{
Expand Down

0 comments on commit 9e13a3b

Please sign in to comment.