Skip to content

Commit

Permalink
Change output of DescribePlugins to suit coredns (#2)
Browse files Browse the repository at this point in the history
This changes the output of DescribePlugins to just list the plugins
coredns can use. A plain list that allows grep | awk etc.

Signed-off-by: Miek Gieben <[email protected]>
  • Loading branch information
miekg authored Oct 11, 2021
1 parent 8adcfe6 commit 028c1b2
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,13 @@ var (
func DescribePlugins() string {
pl := ListPlugins()

str := "Server types:\n"
for _, name := range pl["server_types"] {
str += " " + name + "\n"
}

str += "\nCaddyfile loaders:\n"
for _, name := range pl["caddyfile_loaders"] {
str += " " + name + "\n"
}

if len(pl["event_hooks"]) > 0 {
str += "\nEvent hook plugins:\n"
for _, name := range pl["event_hooks"] {
str += " hook." + name + "\n"
}
}

if len(pl["clustering"]) > 0 {
str += "\nClustering plugins:\n"
for _, name := range pl["clustering"] {
str += " " + name + "\n"
}
}

str += "\nOther plugins:\n"
str := ""
for _, name := range pl["others"] {
str += " " + name + "\n"
if len(name) > 3 {
str += name[4:] + "\n" // drop dns. prefix caddy adds
} else {
str += name + "\n"
}
}

return str
Expand Down

0 comments on commit 028c1b2

Please sign in to comment.