aboutsummaryrefslogtreecommitdiff
path: root/plugin/whoami/setup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/whoami/setup.go')
-rw-r--r--plugin/whoami/setup.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugin/whoami/setup.go b/plugin/whoami/setup.go
new file mode 100644
index 000000000..9797c8bbf
--- /dev/null
+++ b/plugin/whoami/setup.go
@@ -0,0 +1,28 @@
+package whoami
+
+import (
+ "github.com/coredns/coredns/core/dnsserver"
+ "github.com/coredns/coredns/plugin"
+
+ "github.com/mholt/caddy"
+)
+
+func init() {
+ caddy.RegisterPlugin("whoami", caddy.Plugin{
+ ServerType: "dns",
+ Action: setupWhoami,
+ })
+}
+
+func setupWhoami(c *caddy.Controller) error {
+ c.Next() // 'whoami'
+ if c.NextArg() {
+ return plugin.Error("whoami", c.ArgErr())
+ }
+
+ dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
+ return Whoami{}
+ })
+
+ return nil
+}