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 201427b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,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 +352,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 201427b

Please sign in to comment.