nitro_config 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/config.yml +2 -0
- data/docs/CHANGELOG.md +4 -0
- data/docs/README.md +9 -1
- data/lib/nitro_config/options.rb +4 -2
- data/lib/nitro_config/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b383168080e40e84e5ddced9ee9a956bb7b86c90eb90b69980deebd33ab01827
|
4
|
+
data.tar.gz: b49df3dee2c71b884a8a8dd315626d01ab1f2f6fb6a6a0ab1c700bd13f83d516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4afcc350cee4f6635691404ca3232c6b530780889b0f3ba067448534c4a8d1f4d860f50da01a3b9404b54a7519fd3a2b84ac30bb3a98a957d6c393271c1c5aff
|
7
|
+
data.tar.gz: 9651578ae8f6e6c418ecf6bffd6cdc3d004d5f1b52eb1f2385d71bdfa1f0e077af9d789d1a70793a2ce705255d3def5b44ea1b75942956ff4de497a849b0adef
|
data/config/config.yml
CHANGED
data/docs/CHANGELOG.md
CHANGED
data/docs/README.md
CHANGED
@@ -22,6 +22,8 @@ Given the following example config file, the following examples demonstrate how
|
|
22
22
|
base: &base
|
23
23
|
some:
|
24
24
|
nested: value
|
25
|
+
service:
|
26
|
+
api: <%= ENV.fetch("SERVICE_API_URL", "http://localhost:3000/api") %>
|
25
27
|
|
26
28
|
development:
|
27
29
|
<<: *base
|
@@ -43,9 +45,15 @@ test:
|
|
43
45
|
[3] pry(main)> NitroConfig.config.get!('some/other')
|
44
46
|
NitroConfig::Error: some/other not found in app config!
|
45
47
|
from /Users/ben/code/power/nitro/components/nitro_config/lib/nitro_config/options.rb:20:in `block in get!'
|
46
|
-
[
|
48
|
+
[4] pry(main)> NitroConfig.config.get('some/other', 'default')
|
47
49
|
=> "default"
|
50
|
+
[5] pry(main)> NitroConfig.config.get('service/api')
|
51
|
+
=> "http://localhost:3000/api"
|
48
52
|
|
49
53
|
$ RAILS_ENV=test rails c
|
50
54
|
[1] pry(main)> NitroConfig.config.get('some/nested')
|
51
55
|
=> "testvalue"
|
56
|
+
|
57
|
+
$ SERVICE_API_URL="http://test.com" rails c
|
58
|
+
[1] pry(main)> NitroConfig.config.get('service/api')
|
59
|
+
=> "http://test.com"
|
data/lib/nitro_config/options.rb
CHANGED
@@ -9,11 +9,13 @@ module NitroConfig
|
|
9
9
|
# Representation of a config key-value tree with path-based access
|
10
10
|
class Options < HashWithIndifferentAccess
|
11
11
|
def self.load_yml(path, environment)
|
12
|
+
erb_result = ::ERB.new(File.read(path)).result
|
12
13
|
yaml = begin
|
13
|
-
YAML.
|
14
|
+
YAML.safe_load(erb_result, [], [], true)
|
14
15
|
rescue ArgumentError
|
15
|
-
YAML.
|
16
|
+
YAML.safe_load(erb_result, aliases: true)
|
16
17
|
end
|
18
|
+
|
17
19
|
new(yaml[environment])
|
18
20
|
end
|
19
21
|
|
data/lib/nitro_config/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitro_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Palhares
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-08-
|
12
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|