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