king_konf 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 12bcc2dfc6dab65177e3a45e7e942b2e590abd70
4
- data.tar.gz: 094eb6cfcc72836c2fe42a61a2e39858f22c6f77
3
+ metadata.gz: 79a1662b16c52209c5cdf929117c793010c6a2bd
4
+ data.tar.gz: 0cc7fa9c7cff3248513bd864f29cb3846dfee210
5
5
  SHA512:
6
- metadata.gz: b7c8d6b9694360369f4f50f9e600b9767ee7a25852d4f29d9bcc6d946f8148c3f4857236ca9286e321b7547f33d471fb3bc504d759941ccfdbfa61303268c0c4
7
- data.tar.gz: 1b37b769e2cc7b8ab2b6fafe1277839a29e2daa1a17dc2eebefb529e1ed8db3a18b35edafd99a4cf59d1ca16ed0fc5d089b8d1d8d999afc120ac3d8f5dec31e9
6
+ metadata.gz: 04bbcae68698e1580ad31056ee67612fdfb978d0306836317abfb026e1ed40b827538fd5b11fdb1c2e993cf5e70054768bb0e827b3d00993bca0009a913b8786
7
+ data.tar.gz: 76b6918917d47f8fdc10dc4286f510c552d39a38c3672a607bb83dd242dd8f78ef50c23d50b0cd32e4a59599e7d78682471d738aaa271b4060b08d5196f74dec
@@ -132,10 +132,10 @@ module KingKonf
132
132
 
133
133
  def load_env(env)
134
134
  loaded_keys = []
135
- prefix = self.class.prefix || ""
135
+ prefix = self.class.prefix ? "#{self.class.prefix.upcase}_" : ""
136
136
 
137
137
  self.class.variables.each do |variable|
138
- key = "#{prefix.upcase}_#{variable.name.upcase}"
138
+ key = prefix + variable.name.upcase.to_s
139
139
 
140
140
  if string = env[key]
141
141
  value = variable.decode(string)
@@ -144,9 +144,12 @@ module KingKonf
144
144
  end
145
145
  end
146
146
 
147
- env.keys.grep(/^#{prefix.upcase}_/).each do |key|
148
- unless loaded_keys.include?(key)
149
- raise ConfigError, "unknown env variable #{key}"
147
+ # Only complain about unknown ENV vars if there's a prefix defined.
148
+ if self.class.prefix
149
+ env.keys.grep(/^#{prefix}/).each do |key|
150
+ unless loaded_keys.include?(key)
151
+ raise ConfigError, "unknown environment variable #{key}"
152
+ end
150
153
  end
151
154
  end
152
155
  end
@@ -1,3 +1,3 @@
1
1
  module KingKonf
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: king_konf
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
  - Daniel Schierbeck