Update enable-disable-plugins.md (#115)

Found typos on lines 33 and 42
This commit is contained in:
Sandeep Renjith
2018-11-01 15:42:00 +00:00
committed by Miek Gieben
parent 7755ccd8aa
commit 74e70eb910
+72 -72
View File
@@ -12,75 +12,75 @@ disabled on the fly by specifying (or not specifying) it in the
[Corefile](/2017/07/23/corefile-explained/). But you can also compile CoreDNS with only the
plugin you *need* and leave the rest completely out.
There are two ways to achieve that. It could be done via compile-time configuration file
with CoreDNS code base update. It also could be achieved without modifying CoreDNS code.
## Build with compile-time configuration file
The with compile-time configuration file,
[`plugin.cfg`](https://github.com/coredns/coredns/blob/master/plugin.cfg) is all you need
to update. It looks like this:
~~~
...
whoami:whoami
erratic:erratic
startup:github.com/mholt/caddy/startupshutdown
...
~~~
The ordering of the plugins is specified by how the are ordered in this file. Each line consists of
a **name** and a **repository**. Just add or remove your plugin in this file.
Then do a `go get <plugin-repo-path>` if you need to get the external plugin's source code. And then
just compile CoreDNS with `go generate` and a `go build`. You can then check if CoreDNS has the new
plugin with `coredns -plugins`.
## Build with external golang source code
Alternatively, you could assembly plugins from different places through an external golang program.
It looks like this:
~~~
package main
import (
_ "github.com/coredns/example"
"github.com/coredns/coredns/coremain"
"github.com/coredns/coredns/core/dnsserver"
)
var directives = []string{
"example",
...
...
"whoami",
"startup",
"shutdown",
}
func init() {
dnsserver.Directives = directives
}
func main() {
coremain.Run()
}
~~~
In the above sample code, the external plugin `example` has been imported with:
~~~
_ "github.com/coredns/example"
~~~
The directives should also be updated through:
~~~
dnsserver.Directives = directives
~~~
The ordering of the plugins is specified by how the arey ordered in the slice `directives`.
Then you can just compile CoreDNS with `go build` to have the binary generated with the
plugins you selected.
There are two ways to achieve that. It could be done via compile-time configuration file
with CoreDNS code base update. It also could be achieved without modifying CoreDNS code.
## Build with compile-time configuration file
The with compile-time configuration file,
[`plugin.cfg`](https://github.com/coredns/coredns/blob/master/plugin.cfg) is all you need
to update. It looks like this:
~~~
...
whoami:whoami
erratic:erratic
startup:github.com/mholt/caddy/startupshutdown
...
~~~
The ordering of the plugins is specified by how they are ordered in this file. Each line consists of
a **name** and a **repository**. Just add or remove your plugin in this file.
Then do a `go get <plugin-repo-path>` if you need to get the external plugin's source code. And then
just compile CoreDNS with `go generate` and a `go build`. You can then check if CoreDNS has the new
plugin with `coredns -plugins`.
## Build with external golang source code
Alternatively, you could assemble plugins from different places through an external golang program.
It looks like this:
~~~
package main
import (
_ "github.com/coredns/example"
"github.com/coredns/coredns/coremain"
"github.com/coredns/coredns/core/dnsserver"
)
var directives = []string{
"example",
...
...
"whoami",
"startup",
"shutdown",
}
func init() {
dnsserver.Directives = directives
}
func main() {
coremain.Run()
}
~~~
In the above sample code, the external plugin `example` has been imported with:
~~~
_ "github.com/coredns/example"
~~~
The directives should also be updated through:
~~~
dnsserver.Directives = directives
~~~
The ordering of the plugins is specified by how the arey ordered in the slice `directives`.
Then you can just compile CoreDNS with `go build` to have the binary generated with the
plugins you selected.