Commit 44fc9b18 authored by Abiola Ibrahim's avatar Abiola Ibrahim

Print the directives in order of priority.

parent 3b6c387b
...@@ -69,6 +69,15 @@ var directiveOrder = []directive{ ...@@ -69,6 +69,15 @@ var directiveOrder = []directive{
{"browse", setup.Browse}, {"browse", setup.Browse},
} }
// Directives returns the list of directives in order of priority.
func Directives() []string {
directives := make([]string, len(directiveOrder))
for i, d := range directiveOrder {
directives[i] = d.name
}
return directives
}
// RegisterDirective adds the given directive to caddy's list of directives. // RegisterDirective adds the given directive to caddy's list of directives.
// Pass the name of a directive you want it to be placed after, // Pass the name of a directive you want it to be placed after,
// otherwise it will be placed at the bottom of the stack. // otherwise it will be placed at the bottom of the stack.
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"github.com/mholt/caddy/caddy" "github.com/mholt/caddy/caddy"
"github.com/mholt/caddy/caddy/https" "github.com/mholt/caddy/caddy/https"
"github.com/mholt/caddy/caddy/parse"
"github.com/xenolf/lego/acme" "github.com/xenolf/lego/acme"
"gopkg.in/natefinch/lumberjack.v2" "gopkg.in/natefinch/lumberjack.v2"
) )
...@@ -80,7 +79,7 @@ func main() { ...@@ -80,7 +79,7 @@ func main() {
os.Exit(0) os.Exit(0)
} }
if directives { if directives {
for d := range parse.ValidDirectives { for _, d := range caddy.Directives() {
fmt.Println(d) fmt.Println(d)
} }
os.Exit(0) os.Exit(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment