prometheus / common

Go libraries shared across Prometheus components and libraries.
Apache License 2.0
259 stars 306 forks source link

Don't always fetch a OAuth2 token, if the secret from a file didn't change #647

Closed multani closed 21 hours ago

multani commented 3 weeks ago

When configuring a OAuth2 client using the client_secret_file configuration option, the original intent of the code was to not forcefully refetch a token if the content of the file didn't change.

However, both the test and the implementation had 2 typos and a new token token was fetched on every request through the HTTP client:

I extracted the secret variable from the tests to make it, hopefully, a bit clearer to see it's actual type.

multani commented 3 weeks ago

I pushed-force to sign the commit.

roidelapluie commented 1 day ago

Thanks, LGTM, Can you rebase?

multani commented 1 day ago

@roidelapluie I rebased on main :+1: