mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-06 22:40:31 -05:00
Print the directives in order of priority.
This commit is contained in:
parent
3b6c387b84
commit
44fc9b18a6
2 changed files with 10 additions and 2 deletions
|
@ -69,6 +69,15 @@ var directiveOrder = []directive{
|
|||
{"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.
|
||||
// Pass the name of a directive you want it to be placed after,
|
||||
// otherwise it will be placed at the bottom of the stack.
|
||||
|
|
3
main.go
3
main.go
|
@ -14,7 +14,6 @@ import (
|
|||
|
||||
"github.com/mholt/caddy/caddy"
|
||||
"github.com/mholt/caddy/caddy/https"
|
||||
"github.com/mholt/caddy/caddy/parse"
|
||||
"github.com/xenolf/lego/acme"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
@ -80,7 +79,7 @@ func main() {
|
|||
os.Exit(0)
|
||||
}
|
||||
if directives {
|
||||
for d := range parse.ValidDirectives {
|
||||
for _, d := range caddy.Directives() {
|
||||
fmt.Println(d)
|
||||
}
|
||||
os.Exit(0)
|
||||
|
|
Loading…
Reference in a new issue