all repos — website @ 2418364eca7f80f78717e66b9c1d1d56cd26503a

My website

fix ACME in development mode
Alan Pearce alan@alanpearce.eu
Fri, 24 Jan 2025 23:54:02 +0100
commit

2418364eca7f80f78717e66b9c1d1d56cd26503a

parent

51a9cf280ff4045b360519ef8cc1ee4203a2c7bc

1 files changed, 4 insertions(+), 1 deletions(-)

jump to
M internal/server/tls.gointernal/server/tls.go
@@ -7,6 +7,7 @@ "net" 	"net/http"
 	"slices"
 	"strconv"
+	"strings"
 
 	"go.alanpearce.eu/x/listenfd"
 
@@ -39,9 +40,10 @@ certmagic.Default.Logger = log.GetLogger().Named("certmagic") 	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 @@ s.runtimeConfig.Port, 		"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")