| 
									
										
										
										
											2017-06-13 15:47:17 -07:00
										 |  |  | package debug
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							|  |  |  | 	"github.com/coredns/coredns/core/dnsserver"
 | 
					
						
							| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | 	"github.com/coredns/coredns/plugin"
 | 
					
						
							| 
									
										
										
										
											2017-06-13 15:47:17 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/mholt/caddy"
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func init() {
 | 
					
						
							|  |  |  | 	caddy.RegisterPlugin("debug", caddy.Plugin{
 | 
					
						
							|  |  |  | 		ServerType: "dns",
 | 
					
						
							|  |  |  | 		Action:     setup,
 | 
					
						
							|  |  |  | 	})
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func setup(c *caddy.Controller) error {
 | 
					
						
							|  |  |  | 	config := dnsserver.GetConfig(c)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for c.Next() {
 | 
					
						
							|  |  |  | 		if c.NextArg() {
 | 
					
						
							| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | 			return plugin.Error("debug", c.ArgErr())
 | 
					
						
							| 
									
										
										
										
											2017-06-13 15:47:17 -07:00
										 |  |  | 		}
 | 
					
						
							|  |  |  | 		config.Debug = true
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return nil
 | 
					
						
							|  |  |  | }
 |