secret_config 0.10.4 → 1.0.0
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 +4 -4
- data/lib/secret_config/providers/file.rb +7 -1
- data/lib/secret_config/registry.rb +1 -1
- data/lib/secret_config/version.rb +1 -1
- data/test/secret_config_test.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6aad3d7382cdcfce816fb2f045f134cfd8235df19ff66eb35e50030141cd864
|
4
|
+
data.tar.gz: c8538b3208265fa99ea8d6cd26b1e39da4ea26ed8919af56c3e2658811690b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40c6e537b1098a0f977c73ffce4ddada21dd415053789861a4ab5489118cd86b912d6a4444250e7b5eefe5997079b36a0f12d127e743572958fe816afaf85dce
|
7
|
+
data.tar.gz: 59423883acb034d91392d79e512513a9d058e5bff590fe16b8e9385c76f6371bfe491483f2c273d9f70efc73abaae6e06aa177be94a87b37a48db85de9ab9b15
|
@@ -31,11 +31,17 @@ module SecretConfig
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def fetch_path(path)
|
34
|
-
config =
|
34
|
+
config = load_yaml(ERB.new(::File.new(file_name).read).result)
|
35
35
|
|
36
36
|
paths = path.sub(%r{\A/*}, "").sub(%r{/*\Z}, "").split("/")
|
37
37
|
config.dig(*paths)
|
38
38
|
end
|
39
|
+
|
40
|
+
def load_yaml(src)
|
41
|
+
return YAML.safe_load(src, permitted_classes: [Symbol], aliases: true) if Psych::VERSION > "4.0"
|
42
|
+
|
43
|
+
YAML.load(src)
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
data/test/secret_config_test.rb
CHANGED
@@ -47,6 +47,14 @@ class SecretConfigTest < Minitest::Test
|
|
47
47
|
assert_equal "secret_config_test", SecretConfig.fetch("mysql/database")
|
48
48
|
end
|
49
49
|
|
50
|
+
it "fetches with default" do
|
51
|
+
assert_equal "default", SecretConfig.fetch("mysql/unknown", default: "default")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "fetches with default of nil" do
|
55
|
+
assert_nil SecretConfig.fetch("mysql/unknown", default: nil)
|
56
|
+
end
|
57
|
+
|
50
58
|
it "can be overridden by an environment variable" do
|
51
59
|
ENV["MYSQL_DATABASE"] = "other"
|
52
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secret_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
80
|
+
rubygems_version: 3.3.7
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Centralized Configuration and Secrets Management for Ruby and Rails applications.
|