fix ACME in development mode
Alan Pearce alan@alanpearce.eu
Fri, 24 Jan 2025 23:54:02 +0100
1 files changed, 4 insertions(+), 1 deletions(-)
jump to
M internal/server/tls.go → internal/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")