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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/redis/wrapper.rb')
-rw-r--r--lib/gitlab/redis/wrapper.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/gitlab/redis/wrapper.rb b/lib/gitlab/redis/wrapper.rb
index 1ec8818d3f5..2bcf4769b5a 100644
--- a/lib/gitlab/redis/wrapper.rb
+++ b/lib/gitlab/redis/wrapper.rb
@@ -167,20 +167,24 @@ module Gitlab
cert_file = config[:ssl_params].delete(:cert_file)
key_file = config[:ssl_params].delete(:key_file)
- unless ::File.exist?(cert_file)
- raise InvalidPathError,
- "Certificate file #{cert_file} specified in in `resque.yml` does not exist."
+ if cert_file
+ unless ::File.exist?(cert_file)
+ raise InvalidPathError,
+ "Certificate file #{cert_file} specified in in `resque.yml` does not exist."
+ end
+
+ config[:ssl_params][:cert] = OpenSSL::X509::Certificate.new(File.read(cert_file))
end
- config[:ssl_params][:cert] = OpenSSL::X509::Certificate.new(File.read(cert_file))
+ if key_file
+ unless ::File.exist?(key_file)
+ raise InvalidPathError,
+ "Key file #{key_file} specified in in `resque.yml` does not exist."
+ end
- unless ::File.exist?(key_file)
- raise InvalidPathError,
- "Key file #{key_file} specified in in `resque.yml` does not exist."
+ config[:ssl_params][:key] = OpenSSL::PKey.read(File.read(key_file))
end
- config[:ssl_params][:key] = OpenSSL::PKey.read(File.read(key_file))
-
config
end