Support rotating Git credentials#58
Conversation
|
Hey @oneingan - thanks, this is a really good idea. I don't think SIGHUP is going to cut it though. In an environment like kubernetes, there would be nothing to send it. Better to set up a file watcher. |
|
Good point re Kubernetes. Rather than relying on Disclosure: drafted with opencode, model |
|
Updated the PR to implement the single-mechanism approach: auth is now resolved right before each remote op (clone/pull/fetch/push), so |
|
Hmmm reading the file on every request seems inefficient. I don't know if this service will ever experience that much traffic for it to matter, probably not, but it's not much work for AI to make a file watcher - virtually every other kubernetes operator has one. I'm not going to insist but if you're open to add it - please add it. |
|
Good call. I pushed an update that caches If you’d still prefer an fsnotify watcher over the |
What
GIT_PASSWORD_FILEandGITHUB_TOKEN_FILEto read HTTP git credentials from files (trimmed), useful for short-lived tokens.Why
Long-lived
terraform-backend-gitdaemons cache git auth on clone; when tokens rotate/expire, pulls/pushes start failing. Reading credentials from a file and resolving auth per remote operation keeps the backend vendor-agnostic and works well with common rotation mechanisms (e.g. Kubernetes Secret atomic symlink swaps).How to use
GIT_USERNAMEand one ofGIT_PASSWORD_FILE/GITHUB_TOKEN_FILE.Test
nix shell nixpkgs#go nixpkgs#gcc -c go test ./...