diff --git a/Procfile b/Procfile index c0f90c9..92c66e4 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: ./bin/odoh-server +web: ./bin/odoh-server-go diff --git a/go.mod b/go.mod index d610052..ecda512 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/cloudflare/odoh-server-go +// +heroku goVersion go1.14 +// +scalingo goVersion go1.14 go 1.14 require ( diff --git a/odoh_server.go b/odoh_server.go index 0e77279..cbc54af 100644 --- a/odoh_server.go +++ b/odoh_server.go @@ -133,8 +133,10 @@ func main() { } var keyFile string + enableTLSServe := true if keyFile = os.Getenv(keyEnvironmentVariable); keyFile == "" { keyFile = "key.pem" + enableTLSServe = false } keyPair, err := odoh.CreateKeyPairFromSeed(kemID, kdfID, aeadID, seed) @@ -189,6 +191,12 @@ func main() { http.HandleFunc(configEndpoint, target.configHandler) http.HandleFunc("/", server.indexHandler) - log.Printf("Listening on port %v with cert %v and key %v\n", port, certFile, keyFile) - log.Fatal(http.ListenAndServeTLS(fmt.Sprintf(":%s", port), certFile, keyFile, nil)) + if enableTLSServe { + log.Printf("Listening on port %v with cert %v and key %v\n", port, certFile, keyFile) + log.Fatal(http.ListenAndServeTLS(fmt.Sprintf(":%s", port), certFile, keyFile, nil)) + } else { + log.Printf("Listening on port %v without enabling TLS\n", port) + log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil)) + } + }