Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
09751c75
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
09751c75
编写于
4月 03, 2017
作者:
A
Ahmad Sherif
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for Gitaly calls over TCP connection
Closes gitaly#166
上级
2fceb437
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
31 addition
and
3 deletion
+31
-3
config/gitlab.yml.example
config/gitlab.yml.example
+1
-1
config/initializers/8_gitaly.rb
config/initializers/8_gitaly.rb
+1
-1
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+3
-1
spec/lib/gitlab/gitaly_client_spec.rb
spec/lib/gitlab/gitaly_client_spec.rb
+26
-0
未找到文件。
config/gitlab.yml.example
浏览文件 @
09751c75
...
...
@@ -461,7 +461,7 @@ production: &base
storages: # You must have at least a `default` storage path.
default:
path: /home/git/repositories/
gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket
gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket
# TCP connections are supported too (e.g. tcp://host:port)
## Backup settings
backup:
...
...
config/initializers/8_gitaly.rb
浏览文件 @
09751c75
...
...
@@ -9,7 +9,7 @@ if Gitlab.config.gitaly.enabled || Rails.env.test?
raise
"storage
#{
name
.
inspect
}
is missing a gitaly_address"
end
unless
URI
(
address
).
scheme
==
'unix'
unless
URI
(
address
).
scheme
.
in?
(
%w(tcp unix)
)
raise
"Unsupported Gitaly address:
#{
address
.
inspect
}
"
end
...
...
lib/gitlab/gitaly_client.rb
浏览文件 @
09751c75
...
...
@@ -12,9 +12,11 @@ module Gitlab
end
def
self
.
new_channel
(
address
)
# NOTE: Gitaly currently runs on a Unix socket, so permissions are
address
=
address
.
sub
(
%r{^tcp://}
,
''
)
if
URI
(
address
).
scheme
==
'tcp'
# NOTE: When Gitaly runs on a Unix socket, permissions are
# handled using the file system and no additional authentication is
# required (therefore the :this_channel_is_insecure flag)
# TODO: Add authentication support when Gitaly is running on a TCP socket.
GRPC
::
Core
::
Channel
.
new
(
address
,
{},
:this_channel_is_insecure
)
end
...
...
spec/lib/gitlab/gitaly_client_spec.rb
0 → 100644
浏览文件 @
09751c75
require
'spec_helper'
describe
Gitlab
::
GitalyClient
,
lib:
true
do
describe
'.new_channel'
do
context
'when passed a UNIX socket address'
do
it
'passes the address as-is to GRPC::Core::Channel initializer'
do
address
=
'unix:/tmp/gitaly.sock'
expect
(
GRPC
::
Core
::
Channel
).
to
receive
(
:new
).
with
(
address
,
any_args
)
described_class
.
new_channel
(
address
)
end
end
context
'when passed a TCP address'
do
it
'strips tcp:// prefix before passing it to GRPC::Core::Channel initializer'
do
address
=
'localhost:9876'
prefixed_address
=
"tcp://
#{
address
}
"
expect
(
GRPC
::
Core
::
Channel
).
to
receive
(
:new
).
with
(
address
,
any_args
)
described_class
.
new_channel
(
prefixed_address
)
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录