mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 18:23:13 -04:00 
			
		
		
		
	mw/autopath: correct type for type switch (#1029)
* mw/autopath: correct type for type switch Use pointer to kubernetes as that is what is registered. Fix up federation which had the same mistake. * here
This commit is contained in:
		
				
					committed by
					
						 Chris O'Haver
						Chris O'Haver
					
				
			
			
				
	
			
			
			
						parent
						
							c514197d6b
						
					
				
				
					commit
					9528777fc5
				
			| @@ -28,12 +28,11 @@ func setup(c *caddy.Controller) error { | ||||
|  | ||||
| 	// Do this in OnStartup, so all middleware has been initialized. | ||||
| 	c.OnStartup(func() error { | ||||
| 		// TODO(miek): fabricate test to proof this is not thread safe. | ||||
| 		m := dnsserver.GetConfig(c).Handler(mw) | ||||
| 		if m == nil { | ||||
| 			return nil | ||||
| 		} | ||||
| 		if x, ok := m.(kubernetes.Kubernetes); ok { | ||||
| 		if x, ok := m.(*kubernetes.Kubernetes); ok { | ||||
| 			ap.searchFunc = x.AutoPath | ||||
| 		} | ||||
| 		if x, ok := m.(*erratic.Erratic); ok { | ||||
|   | ||||
| @@ -30,7 +30,7 @@ func setup(c *caddy.Controller) error { | ||||
| 		if m == nil { | ||||
| 			return nil | ||||
| 		} | ||||
| 		if x, ok := m.(kubernetes.Kubernetes); ok { | ||||
| 		if x, ok := m.(*kubernetes.Kubernetes); ok { | ||||
| 			fed.Federations = x.Federations | ||||
| 		} | ||||
| 		return nil | ||||
| @@ -38,7 +38,7 @@ func setup(c *caddy.Controller) error { | ||||
|  | ||||
| 	dnsserver.GetConfig(c).AddMiddleware(func(next middleware.Handler) middleware.Handler { | ||||
| 		fed.Next = next | ||||
| 		return nil | ||||
| 		return fed | ||||
| 	}) | ||||
|  | ||||
| 	return nil | ||||
|   | ||||
		Reference in New Issue
	
	Block a user