Add token-based authentication for receiver
All checks were successful
ci / build (push) Successful in 28s

This commit is contained in:
Martin McCaffery 2026-02-11 13:58:42 +01:00
parent 042ce77ddc
commit aa3e8cddf9
Signed by: martin.mccaffery
GPG key ID: 7C4D0F375BCEE533
10 changed files with 635 additions and 41 deletions

View file

@ -31,6 +31,7 @@ func main() {
logFormat := flag.String("log-format", defaultLogFormat, "Output format: json, text")
topN := flag.Int("top", defaultTopN, "Number of top processes to include")
pushEndpoint := flag.String("push-endpoint", "", "HTTP endpoint to push metrics to (e.g., http://localhost:8080/api/v1/metrics)")
pushToken := flag.String("push-token", os.Getenv("COLLECTOR_PUSH_TOKEN"), "Bearer token for push endpoint authentication (or set COLLECTOR_PUSH_TOKEN)")
flag.Parse()
// Setup structured logging for application logs
@ -61,7 +62,7 @@ func main() {
// Setup push client if endpoint is configured
if *pushEndpoint != "" {
pushClient := summary.NewPushClient(*pushEndpoint)
pushClient := summary.NewPushClient(*pushEndpoint, *pushToken)
c.SetPushClient(pushClient)
execCtx := pushClient.ExecutionContext()
appLogger.Info("push client configured",