48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/baha/config.rb', line 48
def init_security
@secure = true
cert_path = ''
ssl_options = { }
if ENV['DOCKER_CERT_PATH']
cert_path = Pathname.new(ENV['DOCKER_CERT_PATH'])
ssl_options[:ssl_verify_peer] = (ENV['DOCKER_TLS_VERIFY'] == '1')
ssl_options[:client_cert] = (cert_path + 'cert.pem').expand_path.to_s
ssl_options[:client_key] = (cert_path + 'key.pem').expand_path.to_s
ssl_options[:ssl_ca_file] = (cert_path + 'ca.pem').expand_path.to_s
elsif @config.has_key?('ssl')
ssl = @config['ssl']
ssl_options[:ssl_verify_peer] = ssl['verify'] || false
if ssl.has_key?('cert_path')
cert_path = Pathname.new(ssl['cert_path'])
ssl_options[:client_cert] = (cert_path + 'cert.pem').expand_path.to_s
ssl_options[:client_key] = (cert_path + 'key.pem').expand_path.to_s
ssl_options[:ssl_ca_file] = (cert_path + 'ca.pem').expand_path.to_s
else
ssl_options[:client_cert] = ssl['cert']
ssl_options[:client_key] = ssl['key']
ssl_options[:ssl_ca_file] = ssl['ca']
end
end
@options.merge!(ssl_options)
end
|