From f064889a4f6230fec37da021087b6e2bfb29cc58 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 3 Jun 2019 15:35:14 -0600 Subject: Customize admin endpoint address with -listen flag This is a temporary holdover for development purposes --- cmd/run.go | 11 ++++++++--- modules/caddytls/standardstek/stek.go | 2 +- 2 files changed, 9 insertions(+), 4 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") diff --git a/modules/caddytls/standardstek/stek.go b/modules/caddytls/standardstek/stek.go index 46ac786..a086872 100644 --- a/modules/caddytls/standardstek/stek.go +++ b/modules/caddytls/standardstek/stek.go @@ -23,7 +23,7 @@ type standardSTEKProvider struct { // Initialize sets the configuration for s and returns the starting keys. func (s *standardSTEKProvider) Initialize(config *caddytls.SessionTicketService) ([][32]byte, error) { - // keep a reference to the config, we'll need when rotating keys + // keep a reference to the config; we'll need it when rotating keys s.stekConfig = config itvl := time.Duration(s.stekConfig.RotationInterval) -- cgit v1.2.3