mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-02 14:17:01 +01: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},
|
{"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.
|
||||||
|
|
3
main.go
3
main.go
|
@ -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() {
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue