process_settings 0.19.0.pre.1 → 0.20.0.pre.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de51169a9cf26a44ceb6b123fcd2aadef73f8303b0fc3e0fb704b284b6f00b58
4
- data.tar.gz: 307e88409813d063891eb8e6015fd0d208b17d7280cf561d97300fbfb1f0b8dc
3
+ metadata.gz: d181fc9c4bdabc2db5115abbc7c99bae9e06a67e590999d403ae001dfb6ab620
4
+ data.tar.gz: ffe647dc7dc05219275650db9ab3324a8c2b9af9fbaa8812e8f4e5330cae6d39
5
5
  SHA512:
6
- metadata.gz: cb53b7565b37fae70ca9509b42dcc15fbab8ffa03122392b9fb780f8b721dc9c6eb33ba0844525d82b038328afd368d764ac16748e5313234824991f78942c1b
7
- data.tar.gz: ed9ac91c42392da4f26f01fb732a72b0cf7321b4ba6843dd0ada7cf022ed6eeded1457f0efec377a50a1182442b12aa5ce8a112f2124c871970345620a7461aa
6
+ metadata.gz: 68209170c9cd7db9bfe54a9c3ebce701b23a244a0c26b96f19150e4b38e63dfc1d3276a5afc9ca3c604155fc6234c6815b7500725062860694816796cdb25d1f
7
+ data.tar.gz: f2ad2f3fbae440124751d175d8f4083c30b7bd530947ec844049ff91fa190a778ceffad0c2a01250e36919fbaaa22584606e18dcee46bba1e66356394e01a5d4
data/README.md CHANGED
@@ -164,6 +164,14 @@ target:
164
164
  ```
165
165
  This will be applied in any process that has (`service_name == "frontend"` OR `service_name == "auth"`) AND `datacenter == "AWS-US-EAST-1"`.
166
166
 
167
+ ### Regexp Targeting
168
+ To provide a regular expression for targeting, use the ruby regex keyword `!ruby/regexp` followed by your regular expression. For example:
169
+ ```
170
+ target:
171
+ service_name: !ruby/regexp /frontend-\d/
172
+ ```
173
+ This will be applied in any process that has `service_name` that has `frontend-` followed with a number. As an example this will match `"frontend-1"`
174
+
167
175
  ### Precedence
168
176
  The settings YAML files are always combined in alphabetical order by file path. Later settings take precedence over the earlier ones.
169
177
 
@@ -38,6 +38,12 @@ module ProcessSettings
38
38
  with_static_context_hash(target_value, static_context_hash)
39
39
  when true, false
40
40
  !target_value == !static_context_hash
41
+ when Regexp
42
+ if static_context_hash.is_a?(String)
43
+ static_context_hash.match?(target_value)
44
+ else
45
+ static_context_hash == target_value
46
+ end
41
47
  else
42
48
  target_value == static_context_hash
43
49
  end
@@ -90,6 +96,12 @@ module ProcessSettings
90
96
  end
91
97
  when true, false
92
98
  target_value
99
+ when Regexp
100
+ if context_hash.is_a?(String)
101
+ context_hash.match?(target_value)
102
+ else
103
+ context_hash == target_value
104
+ end
93
105
  else
94
106
  target_value == context_hash
95
107
  end
@@ -73,7 +73,7 @@ module ProcessSettings
73
73
  end
74
74
 
75
75
  def from_file(file_path, only_meta: false)
76
- json_doc = Psych.load_file(file_path)
76
+ json_doc = Psych.safe_load_file(file_path, permitted_classes: [Regexp])
77
77
  from_array(json_doc, only_meta: only_meta)
78
78
  end
79
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.19.0.pre.1'
4
+ VERSION = '0.20.0.pre.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0.pre.1
4
+ version: 0.20.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca