diff options
author | dev <navdgo@gmail.com> | 2019-05-14 10:35:41 -0400 |
---|---|---|
committer | dev <navdgo@gmail.com> | 2019-05-20 14:48:26 -0400 |
commit | 043eb1d9e5db456b9b78c0423cb44716fc81a932 (patch) | |
tree | a78aee0752b03c4f3c3cb45d409107e64faa10e3 /pkg/caddyscript/matcherenv.go | |
parent | fec7fa8bfda713e8042b9bbf9a480c7792b78c41 (diff) |
move internal packages to pkg folder and update reverse proxy
* set automatic https error type for cert-magic failures
* add state to onload and unload methods
* update reverse proxy to use Provision() and Cleanup()
Diffstat (limited to 'pkg/caddyscript/matcherenv.go')
-rw-r--r-- | pkg/caddyscript/matcherenv.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/caddyscript/matcherenv.go b/pkg/caddyscript/matcherenv.go new file mode 100644 index 0000000..aa9d7fd --- /dev/null +++ b/pkg/caddyscript/matcherenv.go @@ -0,0 +1,18 @@ +package caddyscript + +import ( + "net/http" + + caddyscript "bitbucket.org/lightcodelabs/caddy2/pkg/caddyscript/lib" + "go.starlark.net/starlark" +) + +// MatcherEnv sets up the global context for the matcher caddyscript environment. +func MatcherEnv(r *http.Request) starlark.StringDict { + env := make(starlark.StringDict) + env["req"] = caddyscript.HTTPRequest{Req: r} + env["time"] = caddyscript.Time{} + env["regexp"] = caddyscript.Regexp{} + + return env +} |