Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS support for HTTP Endpoint of Collector server #2798

Merged
merged 9 commits into from
Feb 8, 2021
Prev Previous commit
Next Next commit
rearraging for error logic
Signed-off-by: rjs211 <srivatsa211@gmail.com>
  • Loading branch information
rjs211 committed Feb 8, 2021
commit 0915bca38b70d8aa67734a3a7887a4e092b7f27e
11 changes: 6 additions & 5 deletions cmd/collector/app/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ type HTTPServerParams struct {
func StartHTTPServer(params *HTTPServerParams) (*http.Server, error) {
params.Logger.Info("Starting jaeger-collector HTTP server", zap.String("http host-port", params.HostPort))

listener, err := net.Listen("tcp", params.HostPort)
if err != nil {
return nil, err
}

server := &http.Server{Addr: params.HostPort}
if params.TLSConfig.Enabled {
tlsCfg, err := params.TLSConfig.Config(params.Logger) // This checks if the certificates are correctly provided
Expand All @@ -59,6 +54,12 @@ func StartHTTPServer(params *HTTPServerParams) (*http.Server, error) {
}
server.TLSConfig = tlsCfg
}

listener, err := net.Listen("tcp", params.HostPort)
if err != nil {
return nil, err
}

serveHTTP(server, listener, params)

return server, nil
Expand Down