summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/matchers.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-02-06 18:46:52 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2020-02-06 18:46:52 -0700
commit8b28c36d480070c8cf954cb27bec3b44bd7d12ca (patch)
tree4219adc87173ea3af7603e36e8ef44bb8a791f40 /modules/caddyhttp/matchers.go
parent4a07a5d41e0f54d1a1ec998b9d956ccf2a880d90 (diff)
Remove Starlark, for now
This is temporary as we prepare for a stable v2 release. We don't want to make promises we don't know we can keep, and the Starlark integration deserves much more focused attention which resources and funding do not currently permit. When the project is financially stable, I will be able to revisit this properly and add flexible, robust Starlark scripting support to Caddy 2.
Diffstat (limited to 'modules/caddyhttp/matchers.go')
-rw-r--r--modules/caddyhttp/matchers.go29
1 files changed, 0 insertions, 29 deletions
diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go
index 49fe859..873b63d 100644
--- a/modules/caddyhttp/matchers.go
+++ b/modules/caddyhttp/matchers.go
@@ -28,8 +28,6 @@ import (
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
- "github.com/caddyserver/caddy/v2/pkg/caddyscript"
- "go.starlark.net/starlark"
)
type (
@@ -105,9 +103,6 @@ type (
Matchers MatcherSet `json:"-"`
}
- // MatchStarlarkExpr matches requests by evaluating a Starlark expression.
- MatchStarlarkExpr string
-
// MatchTable matches requests by values in the table.
MatchTable string // TODO: finish implementing
)
@@ -123,7 +118,6 @@ func init() {
caddy.RegisterModule(new(MatchProtocol))
caddy.RegisterModule(MatchRemoteIP{})
caddy.RegisterModule(MatchNegate{})
- caddy.RegisterModule(new(MatchStarlarkExpr))
}
// CaddyModule returns the Caddy module information.
@@ -646,28 +640,6 @@ func (m MatchRemoteIP) Match(r *http.Request) bool {
return false
}
-// CaddyModule returns the Caddy module information.
-func (MatchStarlarkExpr) CaddyModule() caddy.ModuleInfo {
- return caddy.ModuleInfo{
- ID: "http.matchers.starlark",
- New: func() caddy.Module { return new(MatchStarlarkExpr) },
- }
-}
-
-// Match returns true if r matches m.
-func (m MatchStarlarkExpr) Match(r *http.Request) bool {
- input := string(m)
- thread := new(starlark.Thread)
- env := caddyscript.MatcherEnv(r)
- val, err := starlark.Eval(thread, "", input, env)
- if err != nil {
- // TODO: Can we detect this in Provision or Validate instead?
- log.Printf("caddyscript for matcher is invalid: attempting to evaluate expression `%v` error `%v`", input, err)
- return false
- }
- return val.String() == "True"
-}
-
// MatchRegexp is an embeddable type for matching
// using regular expressions. It adds placeholders
// to the request's replacer.
@@ -834,7 +806,6 @@ var (
_ caddy.Provisioner = (*MatchRemoteIP)(nil)
_ RequestMatcher = (*MatchNegate)(nil)
_ caddy.Provisioner = (*MatchNegate)(nil)
- _ RequestMatcher = (*MatchStarlarkExpr)(nil)
_ caddy.Provisioner = (*MatchRegexp)(nil)
_ caddyfile.Unmarshaler = (*MatchHost)(nil)