diff options
-rw-r--r-- | internal/rubyserver/proxy.go | 7 | ||||
-rw-r--r-- | ruby/lib/gitaly_server.rb | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/internal/rubyserver/proxy.go b/internal/rubyserver/proxy.go index 9cb8289e8..7364e9e5f 100644 --- a/internal/rubyserver/proxy.go +++ b/internal/rubyserver/proxy.go @@ -17,6 +17,7 @@ import ( var ProxyHeaderWhitelist = []string{"gitaly-servers"} const ( + storagePathHeader = "gitaly-storage-path" repoPathHeader = "gitaly-repo-path" glRepositoryHeader = "gitaly-gl-repository" repoAltDirsHeader = "gitaly-repo-alt-dirs" @@ -24,6 +25,11 @@ const ( // SetHeaders adds headers that tell gitaly-ruby the full path to the repository. func SetHeaders(ctx context.Context, repo *pb.Repository) (context.Context, error) { + storagePath, err := helper.GetStorageByName(repo.GetStorageName()) + if err != nil { + return nil, err + } + repoPath, err := helper.GetPath(repo) if err != nil { return nil, err @@ -34,6 +40,7 @@ func SetHeaders(ctx context.Context, repo *pb.Repository) (context.Context, erro repoAltDirsCombined := strings.Join(repoAltDirs, string(os.PathListSeparator)) md := metadata.Pairs( + storagePathHeader, storagePath, repoPathHeader, repoPath, glRepositoryHeader, repo.GlRepository, repoAltDirsHeader, repoAltDirsCombined, diff --git a/ruby/lib/gitaly_server.rb b/ruby/lib/gitaly_server.rb index 7b109caa0..aaf6de8f4 100644 --- a/ruby/lib/gitaly_server.rb +++ b/ruby/lib/gitaly_server.rb @@ -13,11 +13,16 @@ require_relative 'gitaly_server/wiki_service.rb' require_relative 'gitaly_server/conflicts_service.rb' module GitalyServer + STORAGE_PATH_HEADER = 'gitaly-storage-path'.freeze REPO_PATH_HEADER = 'gitaly-repo-path'.freeze GL_REPOSITORY_HEADER = 'gitaly-gl-repository'.freeze REPO_ALT_DIRS_HEADER = 'gitaly-repo-alt-dirs'.freeze GITALY_SERVERS_HEADER = 'gitaly-servers'.freeze + def self.storage_path(call) + call.metadata.fetch(STORAGE_PATH_HEADER) + end + def self.repo_path(call) call.metadata.fetch(REPO_PATH_HEADER) end |