myway_config 0.1.1 → 0.1.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: efe5939d49ceba4d8e487b55d12b750b169ba15cf335bc56ddb7d64b4208addd
4
- data.tar.gz: 0e3c94d204b2945791b0c917989bdd547b60a319dd1836e24cd98e05543a5167
3
+ metadata.gz: 7d79d8c65a203d54153cbb96cbe6b3888049b6fa9bc6cb40ea2053da8f304083
4
+ data.tar.gz: 6da321eccf472702e51b6f5def3952701964a68640132f130ab132412d4cbc47
5
5
  SHA512:
6
- metadata.gz: 47cef0ccf3a390d8db6de0f5f5c087000e3c7c2fc7a9a1f1ca199cf04732f2fbfd66526af55a366d767568de7a49e722aa8c53beda6847d9faee64a51faea28a
7
- data.tar.gz: 2f5b310d61faa0717edeae7d68b0cf64b87887925bc9947e434f07ae26d7e87c6f0b521e07a0ac80df60fb128e79f57e7d8c59b4faa77b50ac867230aa43b115
6
+ metadata.gz: 17d350092da29838b7d506e9919182e963f8e1b017b7cb2fd8baa0f77d4e7bb5f3c75cacf4a357b16b568d2151e31f3172b8e023899ec082f3b050a0f6ba11e9
7
+ data.tar.gz: beb0ffbc157279b9958cd40328ac1efc90581ba9e1540d11225b3abf3313e062a41d57b805373a9fada2eaa1149026de157e3642adb87bfc5a138590a8c6ff21
@@ -105,6 +105,23 @@ module MywayConfig
105
105
  ->(v) { v.nil? ? nil : v.to_s.to_sym }
106
106
  end
107
107
 
108
+ # Boolean coercion helper
109
+ #
110
+ # Converts string values "true"/"false" to actual booleans.
111
+ # This is needed for environment variable values.
112
+ #
113
+ # @return [Proc] coercion proc that converts to boolean
114
+ def to_boolean
115
+ ->(v) {
116
+ case v
117
+ when TrueClass, FalseClass then v
118
+ when String then v.downcase == 'true'
119
+ when nil then false
120
+ else !!v
121
+ end
122
+ }
123
+ end
124
+
108
125
  # Deep merge helper for coercion
109
126
  #
110
127
  # @param base [Hash] base hash
@@ -183,17 +200,16 @@ module MywayConfig
183
200
  coercions = {}
184
201
 
185
202
  schema.each do |key, value|
186
- # Pass boolean defaults to attr_config so anyway_config creates predicate methods
187
- if boolean?(value)
188
- attr_config key => value
189
- else
190
- attr_config key
191
- end
203
+ # Don't pass defaults to attr_config - they come from bundled_defaults loader
204
+ # Passing defaults here would cause them to be applied AFTER env vars
205
+ attr_config key
192
206
 
193
207
  coercions[key] = if value.is_a?(Hash)
194
208
  config_section_coercion(key)
195
209
  elsif value.is_a?(Symbol)
196
210
  to_symbol
211
+ elsif boolean?(value)
212
+ to_boolean
197
213
  end
198
214
  end
199
215
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MywayConfig
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myway_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 4.0.3
93
+ rubygems_version: 4.0.4
94
94
  specification_version: 4
95
95
  summary: Configuration management extending anyway_config with XDG support and auto-configuration
96
96
  test_files: []