diff --git a/monitoring.go b/monitoring.go
index dbb0371..1f6827f 100644
--- a/monitoring.go
+++ b/monitoring.go
@@ -10,6 +10,7 @@ import (
"blitiri.com.ar/go/chasquid/internal/config"
"blitiri.com.ar/go/log"
+ "google.golang.org/protobuf/encoding/prototext"
// To enable live profiling in the monitoring server.
_ "net/http/pprof"
@@ -45,6 +46,7 @@ func launchMonitoringServer(conf *config.Config) {
})
http.HandleFunc("/debug/flags", debugFlagsHandler)
+ http.HandleFunc("/debug/config", debugConfigHandler(conf))
go http.ListenAndServe(conf.MonitoringAddress, nil)
}
@@ -94,6 +96,7 @@ os hostname {{.Hostname}}
execution
pprof
@@ -124,6 +127,12 @@ func debugFlagsHandler(w http.ResponseWriter, r *http.Request) {
})
}
+func debugConfigHandler(conf *config.Config) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ _, _ = w.Write([]byte(prototext.Format(conf)))
+ }
+}
+
func roundDuration(d time.Duration) time.Duration {
return d.Round(time.Second)
}
diff --git a/test/t-09-loop/run.sh b/test/t-09-loop/run.sh
index 5b8a5e1..7b6b1ec 100755
--- a/test/t-09-loop/run.sh
+++ b/test/t-09-loop/run.sh
@@ -40,6 +40,8 @@ wget -q -o /dev/null -O .data-A/dbg-flags http://localhost:1099/debug/flags \
|| fail "failed to fetch /debug/flags"
wget -q -o /dev/null -O .data-A/dbg-queue http://localhost:1099/debug/queue \
|| fail "failed to fetch /debug/queue"
+wget -q -o /dev/null -O .data-A/dbg-config http://localhost:1099/debug/config \
+ || fail "failed to fetch /debug/config"
wget -q -o /dev/null -O .data-A/dbg-root http://localhost:1099/404 \
&& fail "fetch /404 worked, should have failed"