orchestration 0.4.13 → 0.4.14

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
  SHA256:
3
- metadata.gz: 3265e0faa40fac54e9e684952a390165dc06da0c5e3d9afbacbfb720a4e829a9
4
- data.tar.gz: 0f458afd34c415f79aa4d93d0abbfa8213bff1b2ad4fe2efb8abd1af870e9081
3
+ metadata.gz: d8603abb707884b67824a5f71c402bff863e53a812be3172cfeb4e9229d448d5
4
+ data.tar.gz: 9b7cc45a5c9abec3fec6b6e09101dd8f04c9c1dbf54ce7e0b280942345fe5a6d
5
5
  SHA512:
6
- metadata.gz: fda5849834e82a0c28731244aacf2737188316159aca07a430eed870cefb2563633e95529b157f27f730ae20fe060d9cfcc41854a74471e5f05533961b01c42c
7
- data.tar.gz: 7516092d74f95892d476c22c6f6157ab6ab7352f201ef30c4995a3a3fa114393bdf5989712c83a107516c42d1a16b1c7519581419980d2adc83b8b1865b3918a
6
+ metadata.gz: d51f959f91e6d740fa6491037561364035ec489131003877f973a1ce3827c1baba24e96f533cbce9e146b5fd30b89e8b8d0b79aec81e543d26f0b27d7711f6c6
7
+ data.tar.gz: a59cf9b833da91425f07c4cc798e2f0949a6fe01ff06f77fed9bfb5c1bce8f2c7f4b97f2b9f2d562d0cd5f262b43a3291cc66e7293d282bff6ffaa90f9a7b2e7
data/README.md CHANGED
@@ -35,7 +35,7 @@ The below screenshot demonstrates _Orchestration_ being installed in a brand new
35
35
  Add _Orchestration_ to your Gemfile:
36
36
 
37
37
  ```ruby
38
- gem 'orchestration', '~> 0.4.13'
38
+ gem 'orchestration', '~> 0.4.14'
39
39
  ```
40
40
 
41
41
  Install:
@@ -11,7 +11,7 @@ module Orchestration
11
11
  # "50123:3306"
12
12
  # otherwise it will be:
13
13
  # "3306" (docker will use an ephemeral host port which we will not use)
14
- "${#{port}\:-sidecar}"
14
+ "${sidecar-#{port}:}"
15
15
  end
16
16
  end
17
17
  end
@@ -45,16 +45,24 @@ module Orchestration
45
45
  def port
46
46
  return @env.app_port if @service_name == 'app'
47
47
 
48
- local, _, remote = @env.docker_compose_config
49
- .fetch('services')
50
- .fetch(@service_name)
51
- .fetch('ports')
52
- .first
53
- .partition(':')
48
+ service = @env.docker_compose_config
49
+ .fetch('services')
50
+ .fetch(@service_name)
54
51
 
52
+ local, remote = parse_port(service)
55
53
  (@env.environment == 'production' ? remote : local).to_i
56
54
  end
57
55
 
56
+ def parse_port(service)
57
+ # Remove our sidecar variable for easier parsing
58
+ # '{sidecar-27018:}27017' => '27018:27017'
59
+ local, _, remote = service.fetch('ports')
60
+ .first
61
+ .sub(/\${sidecar-(\d+):}/, '\1:')
62
+ .partition(':')
63
+ [local, remote]
64
+ end
65
+
58
66
  def yaml(content)
59
67
  # Whitelist `Symbol` and permit aliases:
60
68
  YAML.safe_load(content, [Symbol], [], true)
@@ -17,20 +17,18 @@ module Orchestration
17
17
  end
18
18
 
19
19
  def host
20
- return from_url['host'] unless @env.rabbitmq_url.nil?
21
-
22
- super
20
+ from_url['host'] || super
23
21
  end
24
22
 
25
23
  def port
26
- return from_url['port'] unless @env.rabbitmq_url.nil?
27
-
28
- super
24
+ from_url['port'] || super
29
25
  end
30
26
 
31
27
  private
32
28
 
33
29
  def from_url
30
+ return {} if @env.rabbitmq_url.nil?
31
+
34
32
  uri = URI.parse(@env.rabbitmq_url)
35
33
  { 'host' => uri.host, 'port' => uri.port || 5672 }
36
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchestration
4
- VERSION = '0.4.13'
4
+ VERSION = '0.4.14'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orchestration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2019-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: database_url