Skip to content

Remove TLS support #33

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

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions cmd/gcp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package main

import (
"context"
"crypto/tls"
"flag"
"fmt"
"net/http"
Expand Down Expand Up @@ -52,8 +51,6 @@ var (
notAfterLimit timestampFlag

httpEndpoint = flag.String("http_endpoint", "localhost:6962", "Endpoint for HTTP (host:port).")
tlsCert = flag.String("tls_certificate", "", "Path to server TLS certificate.")
tlsKey = flag.String("tls_key", "", "Path to server TLS private key.")
metricsEndpoint = flag.String("metrics_endpoint", "", "Endpoint for serving metrics; if left empty, metrics will be visible on --http_endpoint.")
tesseraDeadline = flag.Duration("tessera_deadline", time.Second*10, "Deadline for Tessera requests.")
maskInternalErrors = flag.Bool("mask_internal_errors", false, "Don't return error strings with Internal Server Error HTTP responses.")
Expand Down Expand Up @@ -165,20 +162,7 @@ func main() {
}

// Bring up the HTTP server and serve until we get a signal not to.
srv := http.Server{}
if *tlsCert != "" && *tlsKey != "" {
cert, err := tls.LoadX509KeyPair(*tlsCert, *tlsKey)
if err != nil {
klog.Errorf("failed to load TLS certificate/key: %v", err)
}
tlsConfig := &tls.Config{
Certificates: []tls.Certificate{cert},
MinVersion: tls.VersionTLS12,
}
srv = http.Server{Addr: *httpEndpoint, Handler: handler, TLSConfig: tlsConfig}
} else {
srv = http.Server{Addr: *httpEndpoint, Handler: handler}
}
srv := http.Server{Addr: *httpEndpoint, Handler: handler}
shutdownWG := new(sync.WaitGroup)
go awaitSignal(func() {
shutdownWG.Add(1)
Expand All @@ -194,12 +178,7 @@ func main() {
klog.Info("HTTP server shutdown")
})

if *tlsCert != "" && *tlsKey != "" {
err = srv.ListenAndServeTLS("", "")
} else {
err = srv.ListenAndServe()
}
if err != http.ErrServerClosed {
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
klog.Warningf("Server exited: %v", err)
}
// Wait will only block if the function passed to awaitSignal was called,
Expand Down
Loading