mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	all: simply registering plugins (#3287)
Abstract the caddy call and make it simpler. See #3261 for some part of the discussion. Go from: ~~~ go func init() { caddy.RegisterPlugin("any", caddy.Plugin{ ServerType: "dns", Action: setup, }) } ~~~ To: ~~~ go func init() { plugin.Register("any", setup) } ~~~ This requires some external documents in coredns.io to be updated as well; the old way still works, so it's backwards compatible. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
		| @@ -20,7 +20,7 @@ import ( | ||||
| ) | ||||
|  | ||||
| // removed has the names of the plugins that need to error on startup. | ||||
| var removed = []string{"reverse"} | ||||
| var removed = []string{""} | ||||
|  | ||||
| func setup(c *caddy.Controller) error { | ||||
| 	c.Next() | ||||
| @@ -29,10 +29,7 @@ func setup(c *caddy.Controller) error { | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	for _, plugin := range removed { | ||||
| 		caddy.RegisterPlugin(plugin, caddy.Plugin{ | ||||
| 			ServerType: "dns", | ||||
| 			Action:     setup, | ||||
| 		}) | ||||
| 	for _, plug := range removed { | ||||
| 		plugin.Register(plug, setup) | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user