Skip to content

Commit

Permalink
cmd/sunlight: make ACME directory configurable (#3)
Browse files Browse the repository at this point in the history
Also adds a user agent prefix.
  • Loading branch information
mcpherrinm committed Jan 18, 2024
1 parent 0dfc97b commit 74d7754
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/sunlight/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"golang.org/x/crypto/acme"
"golang.org/x/crypto/acme/autocert"
"golang.org/x/sync/errgroup"
"gopkg.in/yaml.v3"
Expand All @@ -50,6 +51,10 @@ type Config struct {

// Cache is the path to the autocert cache directory.
Cache string

// Directory is an ACME directory URL to request a certificate from.
// Defaults to Let's Encrypt Production. Optional.
Directory string
}

DynamoDB struct {
Expand Down Expand Up @@ -283,6 +288,10 @@ func main() {
Prompt: autocert.AcceptTOS,
Email: c.ACME.Email,
HostPolicy: autocert.HostWhitelist(c.ACME.Host),
Client: &acme.Client{
DirectoryURL: c.ACME.Directory,
UserAgent: "filippo.io/sunlight",
},
}
s := &http.Server{
Addr: c.Listen,
Expand Down

0 comments on commit 74d7754

Please sign in to comment.