Commit fc10951d authored by Matt Holt's avatar Matt Holt

Merge pull request #676 from abiosoft/list-directives

Add flag to list directives.
parents 3e48e6a5 44fc9b18
...@@ -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.
......
...@@ -36,6 +36,7 @@ func init() { ...@@ -36,6 +36,7 @@ func init() {
flag.StringVar(&revoke, "revoke", "", "Hostname for which to revoke the certificate") flag.StringVar(&revoke, "revoke", "", "Hostname for which to revoke the certificate")
flag.StringVar(&caddy.Root, "root", caddy.DefaultRoot, "Root path to default site") flag.StringVar(&caddy.Root, "root", caddy.DefaultRoot, "Root path to default site")
flag.BoolVar(&version, "version", false, "Show version") flag.BoolVar(&version, "version", false, "Show version")
flag.BoolVar(&directives, "directives", false, "List supported directives")
} }
func main() { func main() {
...@@ -77,6 +78,12 @@ func main() { ...@@ -77,6 +78,12 @@ func main() {
} }
os.Exit(0) os.Exit(0)
} }
if directives {
for _, d := range caddy.Directives() {
fmt.Println(d)
}
os.Exit(0)
}
// Set CPU cap // Set CPU cap
err := setCPU(cpu) err := setCPU(cpu)
...@@ -212,11 +219,12 @@ const appName = "Caddy" ...@@ -212,11 +219,12 @@ const appName = "Caddy"
// Flags that control program flow or startup // Flags that control program flow or startup
var ( var (
conf string conf string
cpu string cpu string
logfile string logfile string
revoke string revoke string
version bool version bool
directives bool
) )
// Build information obtained with the help of -ldflags // Build information obtained with the help of -ldflags
......
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