prefab-cloud-ruby 1.4.3 → 1.4.4

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: ba7ffe3b2a36411bb03bf96ba0c00d7155cd8d9281ebb6b8ee7463d05f8c3e86
4
- data.tar.gz: 4b2a90345f8383fecc38ec50399b3ddb59c08adf7a480e3de4a50c05e029b85f
3
+ metadata.gz: 63cf097502ebcd1f22ed834cbd4501db2ba7f98b3ebe993b89098f1f105fb2e2
4
+ data.tar.gz: 65458a292125bf925a6609c6cd152b205d94a05a16a4e0cdff9b5460fb6348f1
5
5
  SHA512:
6
- metadata.gz: a4600a4dd4016ffa2041489776a748fc8cd2678401a0039e1f321b3e6a3ff83492cb78224503ff0feb35ad93762ee2078d0cd3c0788590b668ad317b4b597b5b
7
- data.tar.gz: c203ac482b994da015cb49114dafd795f9b8795d5308ad45beb9c81004a09da7706e36d9fb65f2c351477f08dcf652f4e4c75444edc5914cbb4c21894eb7b830
6
+ metadata.gz: 3df29876ef54909d2e605edd1f3d9e947a0c72bfb9d8f86508c517bec392a7c0d2c8c13ca022161c6a964bdeb55ee2d647d7c789888e6fbe9d9a39db516d279b
7
+ data.tar.gz: 183e645a10ad9db7525f2c2d2bd3cecc8826fc161a9ef4e207ec1f45e2fc5a2b41e732e8ede429ac0d91a1fae5c873c9d532ff8f0b273872abeede7698b08e78
@@ -41,3 +41,6 @@ jobs:
41
41
  run: bundle exec rake
42
42
  env:
43
43
  PREFAB_INTEGRATION_TEST_API_KEY: ${{ secrets.PREFAB_INTEGRATION_TEST_API_KEY }}
44
+ PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY: ${{ secrets.PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY }}
45
+ NOT_A_NUMBER: "abcd"
46
+ IS_A_NUMBER: "1234"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.4 - 2024-01-26
4
+
5
+ - Raise when ENV var is missing
6
+
3
7
  ## 1.4.3 - 2024-01-17
4
8
 
5
9
  - Updated proto definition file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.3
1
+ 1.4.4
@@ -68,8 +68,7 @@ module Prefab
68
68
  if :ENV_VAR == config_value.provided.source
69
69
  raw = ENV[config_value.provided.lookup]
70
70
  if raw.nil?
71
- LOG.warn "ENV Variable #{config_value.provided.lookup} not found. Using empty string."
72
- new(Prefab::ConfigValueWrapper.wrap(""), resolver)
71
+ raise Prefab::Errors::MissingEnvVarError.new("Missing environment variable #{config_value.provided.lookup}")
73
72
  else
74
73
  coerced = coerce_into_type(raw, config, config_value.provided.lookup)
75
74
  new(Prefab::ConfigValueWrapper.wrap(coerced, confidential: config_value.confidential), resolver)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Prefab
4
+ module Errors
5
+ class MissingEnvVarError < Prefab::Error
6
+ def initialize(message)
7
+ super(message)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -65,7 +65,11 @@ module Prefab
65
65
  if v.nil?
66
66
  elements << 'tombstone'
67
67
  else
68
- value = @resolver.evaluate(v[:config])&.reportable_value
68
+ value = begin
69
+ @resolver.evaluate(v[:config])&.reportable_value
70
+ rescue StandardError => e
71
+ "ERROR EVALUATING: #{e.class} #{e.message}"
72
+ end
69
73
  elements << value.to_s.slice(0..34).ljust(35)
70
74
  elements << value.class.to_s.slice(0..6).ljust(7)
71
75
  elements << "Match: #{v[:match]}".slice(0..29).ljust(30)
@@ -20,6 +20,7 @@ require 'prefab/errors/initialization_timeout_error'
20
20
  require 'prefab/errors/invalid_api_key_error'
21
21
  require 'prefab/errors/missing_default_error'
22
22
  require 'prefab/errors/env_var_parse_error'
23
+ require 'prefab/errors/missing_env_var_error'
23
24
  require 'prefab/errors/uninitialized_error'
24
25
  require 'prefab/options'
25
26
  require 'prefab/static_logger'
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: prefab-cloud-ruby 1.4.3 ruby lib
5
+ # stub: prefab-cloud-ruby 1.4.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "prefab-cloud-ruby".freeze
9
- s.version = "1.4.3"
9
+ s.version = "1.4.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Jeff Dwyer".freeze]
14
- s.date = "2024-01-17"
14
+ s.date = "2024-01-26"
15
15
  s.description = "Feature Flags, Live Config, and Dynamic Log Levels as a service".freeze
16
16
  s.email = "jdwyer@prefab.cloud".freeze
17
17
  s.executables = ["console".freeze]
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  "lib/prefab/errors/initialization_timeout_error.rb",
55
55
  "lib/prefab/errors/invalid_api_key_error.rb",
56
56
  "lib/prefab/errors/missing_default_error.rb",
57
+ "lib/prefab/errors/missing_env_var_error.rb",
57
58
  "lib/prefab/errors/uninitialized_error.rb",
58
59
  "lib/prefab/evaluation.rb",
59
60
  "lib/prefab/evaluation_summary_aggregator.rb",
@@ -96,6 +96,13 @@ class IntegrationTest
96
96
  case error_type
97
97
  when 'missing_default' then Prefab::Errors::MissingDefaultError
98
98
  when 'initialization_timeout' then Prefab::Errors::InitializationTimeoutError
99
+ when 'unable_to_decrypt' then OpenSSL::Cipher::CipherError
100
+ when 'missing_env_var' then Prefab::Errors::MissingEnvVarError
101
+ when 'unable_to_coerce_env_var' then Prefab::Errors::EnvVarParseError
102
+ else
103
+ unless error_type.nil?
104
+ throw "Unknown error type: #{error_type}"
105
+ end
99
106
  end
100
107
  end
101
108
 
@@ -34,14 +34,16 @@ module IntegrationTestHelpers
34
34
  end
35
35
  end
36
36
 
37
+ SEVERITY_LOOKUP = Prefab::LogPathAggregator::SEVERITY_KEY.invert
38
+
37
39
  def self.prepare_post_data(it)
38
40
  case it.aggregator
39
41
  when "log_path"
40
42
  aggregator = it.test_client.log_path_aggregator
41
43
 
42
- it.data.each do |(path, data)|
43
- data.each_with_index do |count, severity|
44
- count.times { aggregator.push(path, severity) }
44
+ it.data.each do |data|
45
+ data['counts'].each_pair do |severity, count|
46
+ count.times { aggregator.push(data['logger_name'], SEVERITY_LOOKUP[severity]) }
45
47
  end
46
48
  end
47
49
 
@@ -125,8 +127,8 @@ module IntegrationTestHelpers
125
127
  contexts: data.map do |(k, vs)|
126
128
  PrefabProto::Context.new(
127
129
  type: k,
128
- values: vs.map do |v|
129
- [v["key"], PrefabProto::ConfigValue.new(v["value_type"] => v["value"])]
130
+ values: vs.each_pair.map do |key, value|
131
+ [key, Prefab::ConfigValueWrapper.wrap(value)]
130
132
  end.to_h
131
133
  )
132
134
  end
@@ -154,7 +154,9 @@ class TestConfigValueUnwrapper < Minitest::Test
154
154
  lookup: "NON_EXISTENT_ENV_VAR_NAME"
155
155
  )
156
156
  config_value = PrefabProto::ConfigValue.new(provided: value)
157
- assert_equal '', unwrap(config_value, CONFIG, EMPTY_CONTEXT)
157
+ assert_raises(Prefab::Errors::MissingEnvVarError) do
158
+ unwrap(config_value, CONFIG, EMPTY_CONTEXT)
159
+ end
158
160
  end
159
161
 
160
162
  def test_unwrapping_encrypted_values_decrypts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prefab-cloud-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-17 00:00:00.000000000 Z
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -241,6 +241,7 @@ files:
241
241
  - lib/prefab/errors/initialization_timeout_error.rb
242
242
  - lib/prefab/errors/invalid_api_key_error.rb
243
243
  - lib/prefab/errors/missing_default_error.rb
244
+ - lib/prefab/errors/missing_env_var_error.rb
244
245
  - lib/prefab/errors/uninitialized_error.rb
245
246
  - lib/prefab/evaluation.rb
246
247
  - lib/prefab/evaluation_summary_aggregator.rb