Authentication for the /metrics endpoint.
Access rules (checked in order):
Loopback (127.x, ::1) — always allowed without auth.
Bearer token — if
GAMEND_OBSERVABILITY_METRICS_TOKENis set, every non-loopback request must includeAuthorization: Bearer <token>, including private/Docker-internal IPs. (Trusting a private source IP is unsafe behind a proxy that can be made to leaveremote_ipas its own private address.)No token configured — private/Docker-internal IPs are allowed without auth (dev/compose convenience); every other caller is denied. Set the token to scrape from outside the private network.
Configuration
Like push credentials, the setting accepts inline contents or a path to a file holding them (e.g. a docker secret):
# In production — set this to restrict external access
GAMEND_OBSERVABILITY_METRICS_TOKEN=my-secret-prometheus-token
# or, sharing a docker secret with Prometheus's credentials_file:
GAMEND_OBSERVABILITY_METRICS_TOKEN=/run/secrets/metrics_tokenPrometheus scrape config with token:
scrape_configs:
- job_name: "gamend"
bearer_token: "my-secret-prometheus-token"
static_configs:
- targets: ["app:4000"]