Skip to content

Commit

Permalink
chore: lint the code
Browse files Browse the repository at this point in the history
  • Loading branch information
did committed Dec 2, 2024
1 parent 2e0ef39 commit c258d11
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ func (s *Service) createCertManager(hosts []string, options ServiceOptions) (Cer
}

hostPolicy, err := s.createAutoCertHostPolicy(hosts, options)

if err != nil {
return nil, err
}
Expand All @@ -337,14 +336,13 @@ func (s *Service) createCertManager(hosts []string, options ServiceOptions) (Cer
}

func (s *Service) createAutoCertHostPolicy(hosts []string, options ServiceOptions) (autocert.HostPolicy, error) {
slog.Info("createAutoCertHostPolicy called", options.TLSOnDemandUrl, len(hosts), "🚨", "ok")
slog.Info("createAutoCertHostPolicy called", "url", options.TLSOnDemandUrl)

if options.TLSOnDemandUrl == "" {
return autocert.HostWhitelist(hosts...), nil
}

_, err := url.ParseRequestURI(options.TLSOnDemandUrl)

if err != nil {
slog.Error("Unable to parse the tls_on_demand_url URL")
return nil, err
Expand All @@ -353,10 +351,9 @@ func (s *Service) createAutoCertHostPolicy(hosts []string, options ServiceOption
slog.Info("Will use the tls_on_demand_url URL")

return func(ctx context.Context, host string) error {
slog.Info("Get a certificate for", host, "🤞")
slog.Info("Get a certificate", "host", host)

resp, err := http.Get(fmt.Sprintf("%s?host=%s", options.TLSOnDemandUrl, url.QueryEscape(host)))

if err != nil {
slog.Error("Unable to reach the TLS on demand URL", host, err)
return err
Expand Down

0 comments on commit c258d11

Please sign in to comment.