process_settings 0.18.0 → 0.20.0.pre.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
  SHA256:
3
- metadata.gz: aab773e1074ed3b357a5938e9366b56e69bdc6e36ace59835fdea8bbbe49516d
4
- data.tar.gz: 3fe8bb70b1e59498420c878abb86cf2e1b0289694e4ed941a0a11b1a6abc5bce
3
+ metadata.gz: b1badef60c71146241a061aebd1a5911d0780cd1eb2aa0b776f931eaab3d9b7d
4
+ data.tar.gz: 6b9b1d1b7fcb775b316fb8440e9e2786e9a597314fd4b25214620d594e862fbe
5
5
  SHA512:
6
- metadata.gz: 939389ccdfaf3fb4880251e34abc36f15e11963ef1ce69e102208a04e084df0c870eeb906103f9859d6ce7af1e27938d713e153ab16768ee6bbaf0e6c6bb5262
7
- data.tar.gz: bf6190c8812f0fcb73507bfc4b1cda3e2f9370e5c398df8cdbda2a112a23c80479dcf7189d8fb157ae4725b3bcfafe9bef1bb23a63a27eb3351b33d6644e2d04
6
+ metadata.gz: 92c9644c27ec9d38d1e9aeaf39dbaa8a8b20ea3bfd5c7f84e206db81b1b5bdc344e0effe8cf710b6971535b826b2cd98db9e2c3f58dc6e9cf38f3941e65d41d9
7
+ data.tar.gz: f29c738cc2f48ae0961e7794968c68b04f450cf1310139ebf76b933c0f25d205e95d7830f84370d833aa89586e659a64c31b39702670d90854327bd525544a18
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
 
@@ -114,7 +114,11 @@ module ProcessSettings
114
114
  # find last value from matching targets
115
115
  if target_and_settings.target.target_key_matches?(full_context)
116
116
  if (value = target_and_settings.settings.json_doc.mine(*path, not_found_value: :not_found)) != :not_found
117
- latest_result = value
117
+ latest_result = if latest_result.is_a?(Hash) && value.is_a?(Hash)
118
+ latest_result.deep_merge(value)
119
+ else
120
+ value
121
+ end
118
122
  end
119
123
  end
120
124
  latest_result
@@ -90,6 +90,8 @@ module ProcessSettings
90
90
  end
91
91
  when true, false
92
92
  target_value
93
+ when Regexp
94
+ context_hash.match?(target_value)
93
95
  else
94
96
  target_value == context_hash
95
97
  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.18.0'
4
+ VERSION = '0.20.0.pre.1'
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.18.0
4
+ version: 0.20.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - ">="
126
+ - - ">"
127
127
  - !ruby/object:Gem::Version
128
- version: '0'
128
+ version: 1.3.1
129
129
  requirements: []
130
130
  rubygems_version: 3.0.3
131
131
  signing_key: