container_config 0.1.0 → 0.2.0

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: a335fbf082edd704a0fad5393a1211ad20b0533611f688a174112533469c43e9
4
- data.tar.gz: 71cde1c1a6a7f539ff6d9359ea98b594d35a39d19d06148e32c0a2ad1fff25a9
3
+ metadata.gz: 4e3fa143d884c4e9e718054a02b5964a50f33b8bf8b20412d019f1f823b55bd4
4
+ data.tar.gz: f59be34caf1427460dcacc5a9155a930b90ac8f795fc9cca526072381708255a
5
5
  SHA512:
6
- metadata.gz: bbb9e521366c1f740a76d9d473c2eb95a6c9e9a5be2c09856523ec63112a03e6c509cd1820bd7886522de4286bc276b7b9508a4f6120225b2c7082945e37c09c
7
- data.tar.gz: ebd3318980dfe673eb1b4c526f7b5ffb9b7741709376a323a7d01ca521a7f9fbfb93f6b253213cfa1bf75372fed65d13a528a430aa4dbe6b3d14784e380d5802
6
+ metadata.gz: 105ba644ae63e6408ae1cb158916f85ff845a1997c29bbedce410afaf2d7f76e96e81a8080982127c245db7ac8e0b0bddc3a3a7c6db34ca18ece64e2c2a92692
7
+ data.tar.gz: 4180e29ad6571020d5e5720fefa06ccb1ae9ba71860ad1ed45018bd58314b2f0f013bc2bd5272b7f457b7b10b9bd2188e43b3d45c17207fe85ac48253d6b6967
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 2.5
3
3
  NewCops: enable
4
4
 
5
5
  Style/StringLiterals:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2021-07-20
4
+
5
+ - Added `db` key to Redis config
6
+
7
+ ## [0.1.3] - 2021-06-18
8
+
9
+ - Demoted `Could not find value for key` log message to debug level
10
+
11
+ ## [0.1.2] - 2021-05-01
12
+
13
+ - Resolve rexml vulnerability CVE-2021-28965
14
+
15
+ ## [0.1.1] - 2021-03-15
16
+
17
+ - Handle `nil` `Rails.application`
18
+
3
19
  ## [0.1.0] - 2021-03-05
4
20
 
5
21
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- container_config (0.1.0)
4
+ container_config (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -9,12 +9,12 @@ GEM
9
9
  ast (2.4.2)
10
10
  diff-lcs (1.4.4)
11
11
  parallel (1.20.1)
12
- parser (3.0.0.0)
12
+ parser (3.0.2.0)
13
13
  ast (~> 2.4.1)
14
14
  rainbow (3.0.0)
15
- rake (13.0.3)
15
+ rake (13.0.6)
16
16
  regexp_parser (2.1.1)
17
- rexml (3.2.4)
17
+ rexml (3.2.5)
18
18
  rspec (3.10.0)
19
19
  rspec-core (~> 3.10.0)
20
20
  rspec-expectations (~> 3.10.0)
@@ -28,20 +28,20 @@ GEM
28
28
  diff-lcs (>= 1.2.0, < 2.0)
29
29
  rspec-support (~> 3.10.0)
30
30
  rspec-support (3.10.2)
31
- rubocop (1.11.0)
31
+ rubocop (1.18.3)
32
32
  parallel (~> 1.10)
33
33
  parser (>= 3.0.0.0)
34
34
  rainbow (>= 2.2.2, < 4.0)
35
35
  regexp_parser (>= 1.8, < 3.0)
36
36
  rexml
37
- rubocop-ast (>= 1.2.0, < 2.0)
37
+ rubocop-ast (>= 1.7.0, < 2.0)
38
38
  ruby-progressbar (~> 1.7)
39
39
  unicode-display_width (>= 1.4.0, < 3.0)
40
- rubocop-ast (1.4.1)
41
- parser (>= 2.7.1.5)
42
- rubocop-rake (0.5.1)
43
- rubocop
44
- rubocop-rspec (2.2.0)
40
+ rubocop-ast (1.8.0)
41
+ parser (>= 3.0.1.1)
42
+ rubocop-rake (0.6.0)
43
+ rubocop (~> 1.0)
44
+ rubocop-rspec (2.4.0)
45
45
  rubocop (~> 1.0)
46
46
  rubocop-ast (>= 1.1.0)
47
47
  ruby-progressbar (1.11.0)
@@ -61,4 +61,4 @@ DEPENDENCIES
61
61
  yard (~> 0.9)
62
62
 
63
63
  BUNDLED WITH
64
- 2.2.9
64
+ 2.2.16
data/README.md CHANGED
@@ -22,13 +22,13 @@ Or install it yourself as:
22
22
 
23
23
  ```ruby
24
24
  # Retrieve the value of the POSTGRES_USER environment variable, secret mount, or Rails credential
25
- ConfigLoader.load("POSTGRES_USER")
25
+ ContainerConfig.load("POSTGRES_USER")
26
26
 
27
27
  # Retrieve the value of the POSTGRES_PORT environment variable, secret mount, or Rails credential as an integer with a default value of 5432
28
- ConfigLoader.load("POSTGRES_PORT", type: :integer, default: 5432)
28
+ ContainerConfig.load("POSTGRES_PORT", type: :integer, default: 5432)
29
29
 
30
30
  # Retrieve the value of the POSTGRES_PASSWORD environment variable, secret mount, or Rails credential and raise an exception if it cannot be found
31
- ConfigLoader.load("POSTGRES_PASSWORD", required: true)
31
+ ContainerConfig.load("POSTGRES_PASSWORD", required: true)
32
32
  ```
33
33
 
34
34
  Full documentation is available in the [ContainerConfig GitHub Pages](https://wheatevo.github.io/container_config/).
@@ -12,10 +12,11 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Loads container configuration values from environment variables, secrets, and credentials."
13
13
  spec.homepage = "https://github.com/wheatevo/container_config"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/wheatevo/container_config"
19
+ spec.metadata["documentation_uri"] = "https://wheatevo.github.io/container_config/"
19
20
  spec.metadata["changelog_uri"] = "https://github.com/wheatevo/container_config/blob/master/CHANGELOG.md"
20
21
 
21
22
  # Specify which files should be added to the gem when it is released.
@@ -154,7 +154,7 @@ module ContainerConfig
154
154
  def handle_empty_value(config_value, key, **options)
155
155
  if config_value.nil? || config_value.to_s.empty?
156
156
  provider_list = providers.map(&:name).join(", ")
157
- logger.warn { "Could not find value for #{key} in providers: #{provider_list}" }
157
+ logger.debug { "Could not find value for #{key} in providers: #{provider_list}" }
158
158
  raise MissingRequiredValue, "Could not find value for #{key} in providers: #{provider_list}!" if options[:required]
159
159
  else
160
160
  logger.debug { "Configuration value for #{key} loaded" }
@@ -24,7 +24,7 @@ module ContainerConfig
24
24
  #
25
25
  def load(key, *dig_keys, **options)
26
26
  super
27
- ::Rails.application.credentials.config.dig(*dig_keys.map(&:to_sym))
27
+ ::Rails.application&.credentials&.config&.dig(*dig_keys.map(&:to_sym))
28
28
  end
29
29
  end
30
30
  end
@@ -23,12 +23,14 @@ module ContainerConfig
23
23
  url = ContainerConfig.load("#{key}_URL", **options, default: "redis://#{host}:#{port}")
24
24
  sentinels = sentinel_info(key, **options)
25
25
  password = ContainerConfig.load("#{key}_PASSWORD", **options)
26
+ db = ContainerConfig.load("#{key}_DB", **options, type: :integer, coerce_nil: false)
26
27
 
27
28
  # Ensure we never pass an empty string to Redis since it will be passed to the Redis AUTH
28
29
  # command as-is and will cause an exception
29
30
  password = nil if password.to_s.strip.empty?
30
31
 
31
32
  redis_config = { url: url, password: password }
33
+ redis_config[:db] = db if db
32
34
  redis_config[:sentinels] = sentinels unless sentinels.empty?
33
35
 
34
36
  # Add SSL configuration
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ContainerConfig
4
4
  # ContainerConfig version
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: container_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Newell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2021-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -143,6 +143,7 @@ licenses:
143
143
  metadata:
144
144
  homepage_uri: https://github.com/wheatevo/container_config
145
145
  source_code_uri: https://github.com/wheatevo/container_config
146
+ documentation_uri: https://wheatevo.github.io/container_config/
146
147
  changelog_uri: https://github.com/wheatevo/container_config/blob/master/CHANGELOG.md
147
148
  post_install_message:
148
149
  rdoc_options: []
@@ -152,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
153
  requirements:
153
154
  - - ">="
154
155
  - !ruby/object:Gem::Version
155
- version: 2.4.0
156
+ version: 2.5.0
156
157
  required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  requirements:
158
159
  - - ">="