caddy/cmd/run.go

27 lines
457 B
Go
Raw Normal View History

2019-05-06 21:43:04 +03:00
package caddycmd
import (
"flag"
2019-05-06 21:43:04 +03:00
"log"
"github.com/caddyserver/caddy2"
2019-05-06 21:43:04 +03:00
)
// Main executes the main function of the caddy command.
func Main() {
flag.Parse()
err := caddy2.StartAdmin(*listenAddr)
2019-05-06 21:43:04 +03:00
if err != nil {
log.Fatal(err)
}
defer caddy2.StopAdmin()
log.Println("Caddy 2 admin endpoint listening on", *listenAddr)
2019-05-06 21:43:04 +03:00
select {}
}
// TODO: for dev only
var listenAddr = flag.String("listen", ":1234", "The admin endpoint listener address")