go-git-http
go-git-http copied to clipboard
Add support for custom repo resolvers
We needed the ability to add custom resolver logic. Our resolvers also require information from the request such as the host from the request, and the resolve can be optimized to happen at the same time we check auth, so having access to the request in both auth and resolvers is very useful. This change does the following:
- Add support for custom resolver (accepts path / request)
- Add request to AuthInfo
Cleaned up the PR. Looks like there are a bunch of unrelated golint messages. I wouldn't mind cleaning those up in another PR, but it could break consumers since it is complaining about things like casing on existing structures.
I admit I don't quite understand why this is needed, but it sounds like you have a need for it, and this PR is a reasonable addition.
My use case for this functionality would be:
I run go-git-http on multiple horizontally scaled servers for reliability. If a user tries to fetch a repository I could use a custom resolver function to check whether or not that repo exists, then if it doesn't, reach out to a central data store (S3, etc) to fetch the data and hydrate the repo on disk so that the git binary can serve it.