all repos — flounder @ c9d21573cbaeac8450ec41492ea4199db09b7ab7

A small site builder for the Gemini protocol

update cert store code
alex wennerberg alex@alexwennerberg.com
Mon, 02 Nov 2020 09:37:13 -0800
commit

c9d21573cbaeac8450ec41492ea4199db09b7ab7

parent

ddf67161b1e104f89ed248f079bf8b4fed73bddf

1 files changed, 6 insertions(+), 12 deletions(-)

jump to
M gemini.gogemini.go

@@ -57,21 +57,15 @@ server.WriteTimeout = 2 * time.Minute

hostname := strings.SplitN(c.Host, ":", 2)[0] // is this necc? + err := server.Certificates.Load(c.GeminiCertStore) + if err != nil { + } server.CreateCertificate = func(h string) (tls.Certificate, error) { - wildcard := strings.SplitN(h, ".", 2) - if len(wildcard) == 2 { - h = "*." + wildcard[1] - } log.Println("Generating certificate for", h) - cert, err := gmi.CreateCertificate(gmi.CertificateOptions{ + return gmi.CreateCertificate(gmi.CertificateOptions{ DNSNames: []string{h}, - Duration: time.Minute * 43200, // one month + Duration: time.Hour * 760, // one month }) - if err == nil { - // Write the new certificate to disk - err = writeCertificate(path.Join(c.GeminiCertStore, h), cert) - } - return cert, err } var mux gmi.ServeMux

@@ -83,7 +77,7 @@ wildcardMux.HandleFunc("/", gmiPage)

server.Register(hostname, &mux) server.Register("*."+hostname, &wildcardMux) - err := server.ListenAndServe() + err = server.ListenAndServe() if err != nil { log.Fatal(err) }