Skip to content

Commit cfa9b60

Browse files
authored
Remove TLS support (#33)
* Remove TLS support We don't need this for now. It was only added recently to the CTFE and got ported over here. In an effort to splify this binary to its bare minimum, let's remove this for now. We can always add it back later if required. * Add error checking back * nitmergelines
1 parent 7858b01 commit cfa9b60

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

cmd/gcp/main.go

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package main
1717

1818
import (
1919
"context"
20-
"crypto/tls"
2120
"flag"
2221
"fmt"
2322
"net/http"
@@ -52,8 +51,6 @@ var (
5251
notAfterLimit timestampFlag
5352

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

167164
// Bring up the HTTP server and serve until we get a signal not to.
168-
srv := http.Server{}
169-
if *tlsCert != "" && *tlsKey != "" {
170-
cert, err := tls.LoadX509KeyPair(*tlsCert, *tlsKey)
171-
if err != nil {
172-
klog.Errorf("failed to load TLS certificate/key: %v", err)
173-
}
174-
tlsConfig := &tls.Config{
175-
Certificates: []tls.Certificate{cert},
176-
MinVersion: tls.VersionTLS12,
177-
}
178-
srv = http.Server{Addr: *httpEndpoint, Handler: handler, TLSConfig: tlsConfig}
179-
} else {
180-
srv = http.Server{Addr: *httpEndpoint, Handler: handler}
181-
}
165+
srv := http.Server{Addr: *httpEndpoint, Handler: handler}
182166
shutdownWG := new(sync.WaitGroup)
183167
go awaitSignal(func() {
184168
shutdownWG.Add(1)
@@ -194,12 +178,7 @@ func main() {
194178
klog.Info("HTTP server shutdown")
195179
})
196180

197-
if *tlsCert != "" && *tlsKey != "" {
198-
err = srv.ListenAndServeTLS("", "")
199-
} else {
200-
err = srv.ListenAndServe()
201-
}
202-
if err != http.ErrServerClosed {
181+
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
203182
klog.Warningf("Server exited: %v", err)
204183
}
205184
// Wait will only block if the function passed to awaitSignal was called,

0 commit comments

Comments
 (0)