feat(http_client): Add token_file feature
Add a "token_file" option to http::Auth to read the bearer token from a file.
This is especially useful when using a Kubernetes provided token file (/run/secrets/kubernetes.io/serviceaccount/token).
Closes: https://github.com/vectordotdev/vector/issues/20747
Hello @tobz , thanks for the feedback
My use case is to use vector's prometheus_scrape to scrape k8s metrics. This requires authentification, given by a token file that might be refreshed at the kubelet's convenance.
From what I gather from the k8s docs, "The application is responsible for reloading the token when it rotates. Periodic reloading (e.g. once every 5 minutes) is sufficient for most use cases.", so caching the file for a duration is possible ; but that is out of my meager rust expertise for now.
Nice, yeah, that makes sense.
I'll have a chat with the team. I can see the appeal of just reading the file every single time we want to build an authenticated request, but I'm not sure if we're comfortable with that overhead or not.