summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-09-13 17:21:04 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-09-13 17:21:04 -0600
commit0b3161aeea388a092fd5a128191d64e7fd2fd941 (patch)
treea6dafd495a4078f9b70c370131074b2ee0d0e23d /cmd
parent754fe4f7b4dddbfc7a8ee7fee405cee057da858e (diff)
cmd: Customizable user agent (close #2795)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/main.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/main.go b/cmd/main.go
index b91559c..17da8bd 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -41,10 +41,15 @@ func init() {
// set a fitting User-Agent for ACME requests
version, _ := caddy.Version()
cleanModVersion := strings.TrimPrefix(version, "v")
- certmagic.UserAgent = "Caddy/" + cleanModVersion
+ ua := "Caddy/" + cleanModVersion
+ if uaEnv, ok := os.LookupEnv("USERAGENT"); ok {
+ ua = uaEnv + " " + ua
+ }
+ certmagic.UserAgent = ua
// by using Caddy, user indicates agreement to CA terms
- // (very important, or ACME account creation will fail!)
+ // (very important, as Caddy is often non-interactive
+ // and thus ACME account creation will fail!)
certmagic.DefaultACME.Agreed = true
}