diff options
author | Francis Lavoie <[email protected]> | 2024-04-17 14:19:14 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-17 12:19:14 -0600 |
commit | 9cd472c0313b01e71d1f142769c3653058d75c86 (patch) | |
tree | 2393ff4a9a2280e35acfacf4109ca99075c26a43 /context.go | |
parent | e0daa39cd3373d26dcf78ae0d30ac24d1df5dd57 (diff) | |
download | caddy-9cd472c0313b01e71d1f142769c3653058d75c86.tar.gz caddy-9cd472c0313b01e71d1f142769c3653058d75c86.zip |
caddyfile: Populate regexp matcher names by default (#6145)
* caddyfile: Populate regexp matcher names by default
* Some lint cleanup that my VSCode complained about
* Pass down matcher name through expression matcher
* Compat with #6113: fix adapt test, set both styles in replacer
Diffstat (limited to 'context.go')
-rw-r--r-- | context.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/context.go b/context.go index d73af7702..4307dda88 100644 --- a/context.go +++ b/context.go @@ -556,3 +556,15 @@ func (ctx Context) Module() Module { } return ctx.ancestry[len(ctx.ancestry)-1] } + +// WithValue returns a new context with the given key-value pair. +func (ctx *Context) WithValue(key, value any) Context { + return Context{ + Context: context.WithValue(ctx.Context, key, value), + moduleInstances: ctx.moduleInstances, + cfg: ctx.cfg, + ancestry: ctx.ancestry, + cleanupFuncs: ctx.cleanupFuncs, + exitFuncs: ctx.exitFuncs, + } +} |