From 2418364eca7f80f78717e66b9c1d1d56cd26503a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Jan 2025 23:54:02 +0100 Subject: fix ACME in development mode --- internal/server/tls.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'internal') 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") -- cgit 1.4.1