summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-06-03 15:35:14 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-06-03 15:35:14 -0600
commitf064889a4f6230fec37da021087b6e2bfb29cc58 (patch)
tree2893adb470fd695d03afc84df058b444be742884 /cmd
parent34399332354b5cbc742200ef11aa33f199ba6755 (diff)
Customize admin endpoint address with -listen flag
This is a temporary holdover for development purposes
Diffstat (limited to 'cmd')
-rw-r--r--cmd/run.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/run.go b/cmd/run.go
index 1663dfb..47b587a 100644
--- a/cmd/run.go
+++ b/cmd/run.go
@@ -1,6 +1,7 @@
package caddycmd
import (
+ "flag"
"log"
"bitbucket.org/lightcodelabs/caddy2"
@@ -8,14 +9,18 @@ import (
// Main executes the main function of the caddy command.
func Main() {
- addr := ":1234" // TODO: for dev only
- err := caddy2.StartAdmin(addr)
+ flag.Parse()
+
+ err := caddy2.StartAdmin(*listenAddr)
if err != nil {
log.Fatal(err)
}
defer caddy2.StopAdmin()
- log.Println("Caddy 2 admin endpoint listening on", addr)
+ log.Println("Caddy 2 admin endpoint listening on", *listenAddr)
select {}
}
+
+// TODO: for dev only
+var listenAddr = flag.String("listen", ":1234", "The admin endpoint listener address")