Generate certificates on demand

This commit is contained in:
adnano
2020-09-27 23:49:41 -04:00
parent b7340aef27
commit ae4b458964
4 changed files with 46 additions and 30 deletions

View File

@@ -4,19 +4,21 @@ package main
import (
"log"
"time"
"git.sr.ht/~adnano/go-gemini"
gmi "git.sr.ht/~adnano/go-gemini"
)
func main() {
host := "localhost"
crt, key, err := gemini.NewCertificate(host)
duration := 365 * 24 * time.Hour
crt, key, err := gmi.NewRawCertificate(host, duration)
if err != nil {
log.Fatal(err)
}
if err := gemini.WriteCertificate(host, crt, key); err != nil {
if err := gmi.WriteCertificate(host, crt, key); err != nil {
log.Fatal(err)
}
}