| 
									
										
										
										
											2018-03-01 06:49:52 -08:00
										 |  |  | // Package deprecated is used when we deprecated plugin. In plugin.cfg just go from
 | 
					
						
							|  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-07-03 09:04:47 +08:00
										 |  |  | // startup:github.com/caddyserver/caddy/startupshutdown
 | 
					
						
							| 
									
										
										
										
											2018-03-01 06:49:52 -08:00
										 |  |  | //
 | 
					
						
							|  |  |  | // To:
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // startup:deprecated
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // And things should work as expected. This means starting CoreDNS will fail with an error. We can only
 | 
					
						
							|  |  |  | // point to the release notes to details what next steps a user should take. I.e. there is no way to add this
 | 
					
						
							|  |  |  | // to the error generated.
 | 
					
						
							|  |  |  | package deprecated
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							|  |  |  | 	"errors"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/coredns/coredns/plugin"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-03 09:04:47 +08:00
										 |  |  | 	"github.com/caddyserver/caddy"
 | 
					
						
							| 
									
										
										
										
											2018-03-01 06:49:52 -08:00
										 |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // removed has the names of the plugins that need to error on startup.
 | 
					
						
							| 
									
										
										
										
											2018-05-24 14:30:01 +01:00
										 |  |  | var removed = []string{"reverse"}
 | 
					
						
							| 
									
										
										
										
											2018-03-01 06:49:52 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | func setup(c *caddy.Controller) error {
 | 
					
						
							|  |  |  | 	c.Next()
 | 
					
						
							|  |  |  | 	x := c.Val()
 | 
					
						
							|  |  |  | 	return plugin.Error(x, errors.New("this plugin has been deprecated"))
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func init() {
 | 
					
						
							|  |  |  | 	for _, plugin := range removed {
 | 
					
						
							|  |  |  | 		caddy.RegisterPlugin(plugin, caddy.Plugin{
 | 
					
						
							|  |  |  | 			ServerType: "dns",
 | 
					
						
							|  |  |  | 			Action:     setup,
 | 
					
						
							|  |  |  | 		})
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 |