Skip to content

Commit 61642b7

Browse files
caddytls: Run replacer on ask URL, for env vars (#4154)
Fixes #3922
1 parent 3cf443f commit 61642b7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/caddytls/tls.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func (TLS) CaddyModule() caddy.ModuleInfo {
8787
func (t *TLS) Provision(ctx caddy.Context) error {
8888
t.ctx = ctx
8989
t.logger = ctx.Logger(t)
90+
repl := caddy.NewReplacer()
9091

9192
// set up a new certificate cache; this (re)loads all certificates
9293
cacheOpts := certmagic.CacheOptions{
@@ -176,6 +177,11 @@ func (t *TLS) Provision(ctx caddy.Context) error {
176177
onDemandRateLimiter.SetWindow(0)
177178
}
178179

180+
// run replacer on ask URL (for environment variables)
181+
if t.Automation != nil && t.Automation.OnDemand != nil && t.Automation.OnDemand.Ask != "" {
182+
t.Automation.OnDemand.Ask = repl.ReplaceAll(t.Automation.OnDemand.Ask, "")
183+
}
184+
179185
// load manual/static (unmanaged) certificates - we do this in
180186
// provision so that other apps (such as http) can know which
181187
// certificates have been manually loaded, and also so that

0 commit comments

Comments
 (0)