netlify / git-gateway

A Gateway to Git APIs
MIT License
404 stars 89 forks source link

Git-gateway with multiple repos #21

Open rustyb opened 6 years ago

rustyb commented 6 years ago

Hi There - Not a bug to report, simply just not sure where exactly to ask this question.

Is it possible to use git-gateway against multiple repos in a single instance?

I have a working self hosted version of the git-gateway and gotrue working with no issue. But from what I can see the git-gateway instance can only be used against a single repo.

gumaerc commented 4 years ago

I've been trying to answer this question lately, and after digging through the code in this repo it seems like this microservice does have a "multi-tenant mode" that you can activate by using ./git-gateway multi which seems to alter how the service responds. It seems that they refer to different repos as "instances" which have an automatically generated UUID, a name, and a JSON config in the field raw_base_config. From what I can see, you put your common config values (GITGATEWAY_JWT_SECRET, GITGATEWAY_API_HOST, etc.) in your .env file and the values that change; GITGATEWAY_GITHUB_ACCESS_TOKEN, GITGATEWAY_GITHUB_ENDPOINT and GITGATEWAY_GITHUB_REPO go into this raw_base_config field. In instance.go, there is a function called mergeConfig which seems to take your base config and smashes these values into it. It's strange that it doesn't seem to be set up to work with Gitlab or Bitbucket, even through it supports these backends.