From db79b75e35d28c5b0e2f07d77fc974e443781330 Mon Sep 17 00:00:00 2001 From: Zach Shipko Date: Wed, 4 Jan 2017 15:16:27 -0800 Subject: Fixed self-signed certificates when running a dev server --- cmd/ponzu/main.go | 2 +- system/tls/devcerts.go | 2 +- system/tls/enabledev.go | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index b122f7f..6ac6dad 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -185,7 +185,7 @@ func main() { fmt.Println("Enabling self-signed HTTPS... [DEV]") go tls.EnableDev() - fmt.Printf("Server listening on https://localhost:%s for requests... [DEV]\n", db.ConfigCache("https_port")) + fmt.Println("Server listening on https://localhost:10443 for requests... [DEV]") fmt.Println("----") fmt.Println("If your browser rejects HTTPS requests, try allowing insecure connections on localhost.") fmt.Println("on Chrome, visit chrome://flags/#allow-insecure-localhost") diff --git a/system/tls/devcerts.go b/system/tls/devcerts.go index b41f099..f4dc18f 100644 --- a/system/tls/devcerts.go +++ b/system/tls/devcerts.go @@ -126,7 +126,7 @@ func setupDev() { log.Fatalln("Failed to remove old files from dev certificate directory:", err) } - err = os.Mkdir(devcertsPath, os.ModePerm|os.ModePerm) + err = os.Mkdir(devcertsPath, os.ModeDir|os.ModePerm) if err != nil { log.Fatalln("Failed to create directory to locate or save dev certificates:", err) } diff --git a/system/tls/enabledev.go b/system/tls/enabledev.go index a694716..3550fc0 100644 --- a/system/tls/enabledev.go +++ b/system/tls/enabledev.go @@ -5,8 +5,6 @@ import ( "net/http" "os" "path/filepath" - - "github.com/ponzu-cms/ponzu/system/db" ) // EnableDev generates self-signed SSL certificates to use HTTPS & HTTP/2 while @@ -27,6 +25,5 @@ func EnableDev() { cert := filepath.Join(vendorPath, "devcerts", "cert.pem") key := filepath.Join(vendorPath, "devcerts", "key.pem") - port := db.ConfigCache("https_port") - log.Fatalln(http.ListenAndServeTLS(":"+port, cert, key, nil)) + log.Fatalln(http.ListenAndServeTLS(":10443", cert, key, nil)) } -- cgit v1.2.3