Commit d0daa159 authored by Ahmad Hassan's avatar Ahmad Hassan

Rename load_certs and include default cert file

parent b8e45782
...@@ -66,15 +66,20 @@ module Gitlab ...@@ -66,15 +66,20 @@ module Gitlab
end end
end end
def self.load_certs def self.certs
@certs ||= Dir["#{OpenSSL::X509::DEFAULT_CERT_DIR}/*"].map do |cert| return @certs if @certs
cert_paths = Dir["#{OpenSSL::X509::DEFAULT_CERT_DIR}/*"]
cert_paths << OpenSSL::X509::DEFAULT_CERT_FILE if File.exist? OpenSSL::X509::DEFAULT_CERT_FILE
@certs = cert_paths.map do |cert|
File.read(cert) File.read(cert)
end.join("\n") end.join("\n")
end end
def self.stub_creds(storage) def self.stub_creds(storage)
if URI(address(storage)).scheme == 'tls' if URI(address(storage)).scheme == 'tls'
GRPC::Core::ChannelCredentials.new load_certs GRPC::Core::ChannelCredentials.new certs
else else
:this_channel_is_insecure :this_channel_is_insecure
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment