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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2aa1dd04adcc5a0570327825d599e9a0f9a9af87
4
- data.tar.gz: c279d99e8dacd85601293984d6653764db508d4c
3
+ metadata.gz: e18f226a73f9b60d6dd7e9c9a49fd6df9c82ac1d
4
+ data.tar.gz: a9f3235e80372c19c29f6fcf620808b2e98ea815
5
5
  SHA512:
6
- metadata.gz: 16994a1a63a0e6f468d9619113abfda4b0cbf7d7501feb510d8cf814ff24d7dd704f1d56b744105edc7b58e379a631460da8a7f3780746d571cc84144c844c18
7
- data.tar.gz: e75b7829e7572a6864a5301afe36c408d109717c9681a9a8ec336e100c5f55145bb5ae79bf4cb07b2aef08c5edf003e885d1b7d701e90c8719626a8932f377f5
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
- Docker.logger = $logger if ENV['DOCKER_DEBUG'] == 'true'
10
- Docker.url = config.docker.host
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 ||= begin
35
- if ENV['DOCKER_CERT_PATH']
36
- File.expand_path(ENV['DOCKER_CERT_PATH'])
37
- else
38
- nil
39
- end
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
@@ -1,3 +1,3 @@
1
1
  module Percheron
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percheron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash McKenzie