summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2021-05-09 00:37:27 -0400
committerGitHub <noreply@github.com>2021-05-08 22:37:27 -0600
commit61642b766baaa8cef62f5a7ea3c29d8ebdbd86ea (patch)
tree81e214b693453e6e01fb4b79bc5792ff2c2acda9 /modules
parent3cf443f0feee50a5de3f31daf79af1b8f70ebc76 (diff)
caddytls: Run replacer on ask URL, for env vars (#4154)
Fixes #3922
Diffstat (limited to 'modules')
-rw-r--r--modules/caddytls/tls.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index c111bbb..a93183e 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -87,6 +87,7 @@ func (TLS) CaddyModule() caddy.ModuleInfo {
func (t *TLS) Provision(ctx caddy.Context) error {
t.ctx = ctx
t.logger = ctx.Logger(t)
+ repl := caddy.NewReplacer()
// set up a new certificate cache; this (re)loads all certificates
cacheOpts := certmagic.CacheOptions{
@@ -176,6 +177,11 @@ func (t *TLS) Provision(ctx caddy.Context) error {
onDemandRateLimiter.SetWindow(0)
}
+ // run replacer on ask URL (for environment variables)
+ if t.Automation != nil && t.Automation.OnDemand != nil && t.Automation.OnDemand.Ask != "" {
+ t.Automation.OnDemand.Ask = repl.ReplaceAll(t.Automation.OnDemand.Ask, "")
+ }
+
// load manual/static (unmanaged) certificates - we do this in
// provision so that other apps (such as http) can know which
// certificates have been manually loaded, and also so that