mirror of
https://github.com/coredns/coredns.git
synced 2025-12-02 16:44:01 -05:00
@@ -25,7 +25,7 @@ autopath.Func. Note the searchpath must be ending with the empty string.
|
||||
|
||||
I.e:
|
||||
|
||||
func (m Middleware ) AutoPath(state request.Request) []string {
|
||||
func (m Plugins ) AutoPath(state request.Request) []string {
|
||||
return []string{"first", "second", "last", ""}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -49,8 +49,8 @@ func setup(c *caddy.Controller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// allowedMiddleware has a list of plugin that can be used by autopath.
|
||||
var allowedMiddleware = map[string]bool{
|
||||
// allowedPlugins has a list of plugin that can be used by autopath.
|
||||
var allowedPlugins = map[string]bool{
|
||||
"@kubernetes": true,
|
||||
"@erratic": true,
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func autoPathParse(c *caddy.Controller) (*AutoPath, string, error) {
|
||||
}
|
||||
resolv := zoneAndresolv[len(zoneAndresolv)-1]
|
||||
if resolv[0] == '@' {
|
||||
_, ok := allowedMiddleware[resolv]
|
||||
_, ok := allowedPlugins[resolv]
|
||||
if ok {
|
||||
mw = resolv[1:]
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestSetupAutoPath(t *testing.T) {
|
||||
}
|
||||
|
||||
if !test.shouldErr && mw != test.expectedMw {
|
||||
t.Errorf("Test %d, Middleware not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedMw, mw)
|
||||
t.Errorf("Test %d, Plugin not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedMw, mw)
|
||||
}
|
||||
if !test.shouldErr && ap.search != nil {
|
||||
if !reflect.DeepEqual(test.expectedSearch, ap.search) {
|
||||
|
||||
Reference in New Issue
Block a user