about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2025-01-24 23:54:02 +0100
committerAlan Pearce2025-01-24 23:54:02 +0100
commit2418364eca7f80f78717e66b9c1d1d56cd26503a (patch)
tree729e628336d4d207a3ce08203f0f1752c1b280f1
parent51a9cf280ff4045b360519ef8cc1ee4203a2c7bc (diff)
downloadwebsite-2418364eca7f80f78717e66b9c1d1d56cd26503a.tar.lz
website-2418364eca7f80f78717e66b9c1d1d56cd26503a.tar.zst
website-2418364eca7f80f78717e66b9c1d1d56cd26503a.zip
fix ACME in development mode
-rw-r--r--internal/server/tls.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/server/tls.go b/internal/server/tls.go
index f51d36a..40fddac 100644
--- a/internal/server/tls.go
+++ b/internal/server/tls.go
@@ -7,6 +7,7 @@ import (
 	"net/http"
 	"slices"
 	"strconv"
+	"strings"
 
 	"go.alanpearce.eu/x/listenfd"
 
@@ -39,9 +40,10 @@ func (s *Server) serveTLS() (err error) {
 	cfg := certmagic.NewDefault()
 
 	acme := &certmagic.DefaultACME
+	acme.Logger = certmagic.Default.Logger
 	acme.Agreed = true
 	acme.Email = s.config.Email
-	acme.ListenHost = s.runtimeConfig.ListenAddress
+	acme.ListenHost = strings.Trim(s.runtimeConfig.ListenAddress, "[]")
 
 	if s.runtimeConfig.Development {
 		ca := s.runtimeConfig.ACMECA
@@ -157,6 +159,7 @@ func (s *Server) serveTLS() (err error) {
 		"https_port",
 		s.runtimeConfig.TLSPort,
 	)
+	cfg.Issuers = []certmagic.Issuer{certmagic.NewACMEIssuer(cfg, *acme)}
 	err = cfg.ManageAsync(context.TODO(), certificateDomains)
 	if err != nil {
 		return errors.WithMessage(err, "could not enable TLS")