percheron 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/percheron/docker_connection.rb +34 -24
- data/lib/percheron/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e18f226a73f9b60d6dd7e9c9a49fd6df9c82ac1d
|
4
|
+
data.tar.gz: a9f3235e80372c19c29f6fcf620808b2e98ea815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 281eebaec3b0e16468d82a7396af767e3d0453a929fbc3fdec0c9ebfe4ff184adacf5306913b153f0e71d6cc4f01d34c2705caf9fe2e9b64036d95506cf6a86a
|
7
|
+
data.tar.gz: 6c75aa2ba576b00d448901c6d18b8c8edc0a38d664a64993c3647f8044a959e05bf665d46e9ae146e0ef2ef0cd2b17199a22aec74b6bdcaa557e3cd690316877
|
@@ -6,24 +6,8 @@ module Percheron
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def setup!
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
opts = {
|
13
|
-
chunk_size: 1,
|
14
|
-
connect_timeout: config.docker.timeout,
|
15
|
-
scheme: 'https'
|
16
|
-
}
|
17
|
-
|
18
|
-
if cert_path
|
19
|
-
opts.merge!({
|
20
|
-
client_cert: File.join(cert_path, 'cert.pem'),
|
21
|
-
client_key: File.join(cert_path, 'key.pem'),
|
22
|
-
ssl_ca_file: File.join(cert_path, 'ca.pem')
|
23
|
-
})
|
24
|
-
end
|
25
|
-
|
26
|
-
Docker.options = opts
|
9
|
+
set_url!
|
10
|
+
set_options!
|
27
11
|
end
|
28
12
|
|
29
13
|
private
|
@@ -31,13 +15,39 @@ module Percheron
|
|
31
15
|
attr_reader :config
|
32
16
|
|
33
17
|
def cert_path
|
34
|
-
@cert_path ||=
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
18
|
+
@cert_path ||= ENV['DOCKER_CERT_PATH'] ? File.expand_path(ENV['DOCKER_CERT_PATH']) : nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_url!
|
22
|
+
Docker.url = config.docker.host
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_options!
|
26
|
+
Docker.options = docker_options
|
27
|
+
end
|
28
|
+
|
29
|
+
def docker_options
|
30
|
+
base_docker_options.merge(extra_docker_opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def base_docker_options
|
34
|
+
{
|
35
|
+
connect_timeout: config.docker.timeout,
|
36
|
+
scheme: 'https'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def extra_docker_opts
|
41
|
+
if cert_path
|
42
|
+
{
|
43
|
+
client_cert: File.join(cert_path, 'cert.pem'),
|
44
|
+
client_key: File.join(cert_path, 'key.pem'),
|
45
|
+
ssl_ca_file: File.join(cert_path, 'ca.pem')
|
46
|
+
}
|
47
|
+
else
|
48
|
+
{}
|
40
49
|
end
|
41
50
|
end
|
51
|
+
|
42
52
|
end
|
43
53
|
end
|
data/lib/percheron/version.rb
CHANGED