Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-12-15 22:47:56 +0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-12-15 22:47:56 +0300
commit8b64674cf653928732d4ecd417a000120e34ad2a (patch)
tree0de24f1226af8018a70dfcc522b7635425ffcbb7
parentc4c65e51a4f466ec5398f79dd32e2530c4e9b917 (diff)
Pass storage_path to gitaly-ruby
-rw-r--r--internal/rubyserver/proxy.go7
-rw-r--r--ruby/lib/gitaly_server.rb5
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