king_konf 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/king_konf/config.rb +11 -2
- data/lib/king_konf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1720918d95b599552ba22661add4aebf7066bd13
|
4
|
+
data.tar.gz: 0bea3bcfc51e38894f83d8f221e88c3482d5373e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8509516768a5a9e84ffef2ae63ffeba5760e0f4e1fbaab6674c29cda12378c89c95f59e7b5dc92717d775847a5f22b3c8b5968d10446d62b090c9b74aab86db
|
7
|
+
data.tar.gz: 3825943e70cfc28c67f7e2718c158b4531b57092bc7403c5864e677cb24cdc63133d0dbc83532ac89a2e92735f7e8e9cab691bd62e8962cf19b756b5156bf10f
|
data/lib/king_konf/config.rb
CHANGED
@@ -11,6 +11,15 @@ module KingKonf
|
|
11
11
|
@env_prefix
|
12
12
|
end
|
13
13
|
|
14
|
+
def ignore_unknown_variables(should_ignore)
|
15
|
+
@ignore_unknown_variables = should_ignore
|
16
|
+
end
|
17
|
+
|
18
|
+
def ignore_unknown_variables?
|
19
|
+
# Always ignore about unknown ENV vars if there's no prefix defined.
|
20
|
+
@ignore_unknown_variables || !env_prefix
|
21
|
+
end
|
22
|
+
|
14
23
|
def variable(name)
|
15
24
|
@variables.fetch(name.to_s)
|
16
25
|
end
|
@@ -127,8 +136,8 @@ module KingKonf
|
|
127
136
|
end
|
128
137
|
end
|
129
138
|
|
130
|
-
|
131
|
-
|
139
|
+
|
140
|
+
unless self.class.ignore_unknown_variables?
|
132
141
|
env.keys.grep(/^#{prefix}/).each do |key|
|
133
142
|
unless loaded_keys.include?(key)
|
134
143
|
raise ConfigError, "unknown environment variable #{key}"
|
data/lib/king_konf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: king_konf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|