mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
cmd: Customizable user agent (close #2795)
This commit is contained in:
parent
754fe4f7b4
commit
0b3161aeea
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue