mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Expose directives in dnsserver to help external plugin developers (#1315)
This fix expose directives in dnsserver package, so that external
plugin developers could easily build customerized coredns+plugin
without changing the code base tree of coredns.
The following is an example that could bundle coredns+example,
in one simple file without modifying coredns codebase:
```
package main
import (
_ "github.com/coredns/example"
"github.com/coredns/coredns/coremain"
"github.com/coredns/coredns/core/dnsserver"
)
var directives = []string{
"example",
"log",
"errors",
...
...
...
"whoami",
"startup",
"shutdown",
}
func init() {
dnsserver.Directives = directives
}
func main() {
coremain.Run()
}
```
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@@ -22,7 +22,7 @@ func init() {
|
||||
flag.StringVar(&Port, serverType+".port", DefaultPort, "Default port")
|
||||
|
||||
caddy.RegisterServerType(serverType, caddy.ServerType{
|
||||
Directives: func() []string { return directives },
|
||||
Directives: func() []string { return Directives },
|
||||
DefaultInput: func() caddy.Input {
|
||||
return caddy.CaddyfileInput{
|
||||
Filepath: "Corefile",
|
||||
|
||||
@@ -9,8 +9,7 @@ package dnsserver
|
||||
// feel the effects of all other plugin below
|
||||
// (after) them during a request, but they must not
|
||||
// care what plugin above them are doing.
|
||||
|
||||
var directives = []string{
|
||||
var Directives = []string{
|
||||
"tls",
|
||||
"nsid",
|
||||
"root",
|
||||
|
||||
@@ -81,8 +81,7 @@ func genDirectives(file, pack string, md []string) {
|
||||
// feel the effects of all other plugin below
|
||||
// (after) them during a request, but they must not
|
||||
// care what plugin above them are doing.
|
||||
|
||||
var directives = []string{
|
||||
var Directives = []string{
|
||||
`
|
||||
|
||||
for i := range md {
|
||||
|
||||
Reference in New Issue
Block a user