Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c6979035
Commit
c6979035
authored
Oct 25, 2018
by
Ahmad Hassan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support tls communication in gitaly
parent
4845401f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+17
-4
No files found.
config/initializers/1_settings.rb
View file @
c6979035
...
...
@@ -429,6 +429,7 @@ Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour
# Gitaly
#
Settings
[
'gitaly'
]
||=
Settingslogic
.
new
({})
Settings
.
gitaly
[
'tls'
]
||=
Settingslogic
.
new
({})
#
# Webpack settings
...
...
lib/gitlab/gitaly_client.rb
View file @
c6979035
...
...
@@ -53,6 +53,10 @@ module Gitlab
base_labels
Gitlab
::
Metrics
::
Transaction
::
BASE_LABELS
.
merge
(
gitaly_service:
nil
,
rpc:
nil
)
end
def
self
.
creds
Gitlab
.
config
.
gitaly
.
tls
.
credentials
end
def
self
.
stub
(
name
,
storage
)
MUTEX
.
synchronize
do
@stubs
||=
{}
...
...
@@ -60,11 +64,20 @@ module Gitlab
@stubs
[
storage
][
name
]
||=
begin
klass
=
stub_class
(
name
)
addr
=
stub_address
(
storage
)
klass
.
new
(
addr
,
:this_channel_is_insecure
)
creds
=
stub_creds
(
storage
)
klass
.
new
(
addr
,
creds
)
end
end
end
def
self
.
stub_creds
(
storage
)
if
URI
(
address
(
storage
)).
scheme
==
'tls'
GRPC
::
Code
::
ChannelCredentials
.
new
else
:this_channel_is_insecure
end
end
def
self
.
stub_class
(
name
)
if
name
==
:health_check
Grpc
::
Health
::
V1
::
Health
::
Stub
...
...
@@ -75,7 +88,7 @@ module Gitlab
def
self
.
stub_address
(
storage
)
addr
=
address
(
storage
)
addr
=
addr
.
sub
(
%r{^tcp://
}
,
''
)
if
URI
(
addr
).
scheme
==
'tcp'
addr
=
addr
.
sub
(
%r{^tcp://
|^tls://}
,
''
)
if
%w(tcp tls)
.
include?
URI
(
addr
).
scheme
addr
end
...
...
@@ -98,8 +111,8 @@ module Gitlab
raise
"storage
#{
storage
.
inspect
}
is missing a gitaly_address"
end
unless
URI
(
address
).
scheme
.
in?
(
%w(tcp unix)
)
raise
"Unsupported Gitaly address:
#{
address
.
inspect
}
does not use URL scheme 'tcp' or 'unix'"
unless
URI
(
address
).
scheme
.
in?
(
%w(tcp unix
tls
)
)
raise
"Unsupported Gitaly address:
#{
address
.
inspect
}
does not use URL scheme 'tcp' or 'unix'
or 'tls'
"
end
address
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment