mirror of
https://github.com/Luzifer/mercedes-byocar-exporter.git
synced 2024-11-09 14:30:08 +00:00
Add health-check endpoint
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3982c9c381
commit
1d55196bdf
2 changed files with 2 additions and 0 deletions
|
@ -55,6 +55,7 @@ In all cases specify one or more `--vehicle-id` (`VEHICLE_ID=WDB111111ZZZ22222,W
|
||||||
When everything is running you should be able to access the exporter:
|
When everything is running you should be able to access the exporter:
|
||||||
|
|
||||||
- `https://exporter.example.com/auth` - Redirect to authorize your project to access your car(s)
|
- `https://exporter.example.com/auth` - Redirect to authorize your project to access your car(s)
|
||||||
|
- `https://exporter.example.com/healthz` - Health-Check endpoint
|
||||||
- `https://exporter.example.com/metrics` - Text-version of exported metrics
|
- `https://exporter.example.com/metrics` - Text-version of exported metrics
|
||||||
|
|
||||||
You need to access the `/auth` route once to fetch access- and refresh-keys. If something wents wrong with those keys you can re-authorize the app using this route.
|
You need to access the `/auth` route once to fetch access- and refresh-keys. If something wents wrong with those keys you can re-authorize the app using this route.
|
||||||
|
|
1
main.go
1
main.go
|
@ -76,6 +76,7 @@ func main() {
|
||||||
// Register HTTP handlers
|
// Register HTTP handlers
|
||||||
http.DefaultServeMux.HandleFunc("/auth", getAuthRedirectHandler(mClient))
|
http.DefaultServeMux.HandleFunc("/auth", getAuthRedirectHandler(mClient))
|
||||||
http.DefaultServeMux.HandleFunc("/store-token", getAuthStoreTokenHandler(mClient, creds))
|
http.DefaultServeMux.HandleFunc("/store-token", getAuthStoreTokenHandler(mClient, creds))
|
||||||
|
http.DefaultServeMux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("OK")) })
|
||||||
http.DefaultServeMux.Handle("/metrics", promhttp.Handler())
|
http.DefaultServeMux.Handle("/metrics", promhttp.Handler())
|
||||||
|
|
||||||
scheduler := cron.New()
|
scheduler := cron.New()
|
||||||
|
|
Loading…
Reference in a new issue