flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit c9d21573cbaeac8450ec41492ea4199db09b7ab7
parent ddf67161b1e104f89ed248f079bf8b4fed73bddf
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon,  2 Nov 2020 09:37:13 -0800

update cert store code

Diffstat:
Mgemini.go | 18++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/gemini.go b/gemini.go @@ -57,21 +57,15 @@ func runGeminiServer() { 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 @@ func runGeminiServer() { server.Register(hostname, &mux) server.Register("*."+hostname, &wildcardMux) - err := server.ListenAndServe() + err = server.ListenAndServe() if err != nil { log.Fatal(err) }