confg 3.2.0 → 3.3.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/confg.gemspec +5 -5
- data/lib/confg/configuration.rb +19 -0
- data/lib/confg/version.rb +1 -1
- metadata +5 -10
- data/.github/dependabot.yml +0 -24
- data/.github/workflows/build.yml +0 -22
- data/.gitignore +0 -17
- data/.ruby-version +0 -1
- data/Gemfile +0 -4
- data/README.md +0 -54
- data/Rakefile +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a8d68f7467992b67e6498153d220d203432287054549f768546f70127e6923f
|
|
4
|
+
data.tar.gz: add43866b97a32d137455b63a79778669310fda072ecb79d6f22937fef0b17c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6203dc566bdfa5bc6c4acc16a8e610384f225d7aa221f26e6f40e71824922b78aa78d9335bbea1755e0bf88831f2b29eb6feca7f96c64a0290e82afe74f36261
|
|
7
|
+
data.tar.gz: f47490f355212bdb0d62cf24440405377f52f99f417d918ca795abdaa408264a87d96d74ee6c01eafade40532e93fd330568d2329b3b3be9fd57311a26aac6e7
|
data/confg.gemspec
CHANGED
|
@@ -15,14 +15,14 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
|
21
|
-
end
|
|
18
|
+
spec.files = Dir["lib/**/*"] + Dir["*.gemspec"]
|
|
19
|
+
|
|
22
20
|
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
23
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
24
21
|
spec.require_paths = ["lib"]
|
|
25
22
|
|
|
23
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
24
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
25
|
+
|
|
26
26
|
spec.add_development_dependency "bundler"
|
|
27
27
|
spec.add_development_dependency "byebug"
|
|
28
28
|
spec.add_development_dependency "minitest", "~> 5.0"
|
data/lib/confg/configuration.rb
CHANGED
|
@@ -32,6 +32,25 @@ module Confg
|
|
|
32
32
|
end
|
|
33
33
|
alias merge! merge
|
|
34
34
|
|
|
35
|
+
def load_env(prefix: "CONFG_", separator: "__")
|
|
36
|
+
overrides = {}
|
|
37
|
+
|
|
38
|
+
ENV.each do |key, value|
|
|
39
|
+
next unless key.start_with?(prefix)
|
|
40
|
+
|
|
41
|
+
segments = key.delete_prefix(prefix).downcase.split(separator)
|
|
42
|
+
|
|
43
|
+
# Build nested hash: ["database", "host"] => { "database" => { "host" => value } }
|
|
44
|
+
current = overrides
|
|
45
|
+
segments[0...-1].each do |segment|
|
|
46
|
+
current = (current[segment] ||= {})
|
|
47
|
+
end
|
|
48
|
+
current[segments.last] = value
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
merge(overrides)
|
|
52
|
+
end
|
|
53
|
+
|
|
35
54
|
def to_h
|
|
36
55
|
confg_data.transform_values do |v|
|
|
37
56
|
v.is_a?(self.class) ? v.to_h : v
|
data/lib/confg/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: confg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Nelson
|
|
@@ -72,13 +72,6 @@ executables: []
|
|
|
72
72
|
extensions: []
|
|
73
73
|
extra_rdoc_files: []
|
|
74
74
|
files:
|
|
75
|
-
- ".github/dependabot.yml"
|
|
76
|
-
- ".github/workflows/build.yml"
|
|
77
|
-
- ".gitignore"
|
|
78
|
-
- ".ruby-version"
|
|
79
|
-
- Gemfile
|
|
80
|
-
- README.md
|
|
81
|
-
- Rakefile
|
|
82
75
|
- confg.gemspec
|
|
83
76
|
- lib/confg.rb
|
|
84
77
|
- lib/confg/configuration.rb
|
|
@@ -87,7 +80,9 @@ files:
|
|
|
87
80
|
homepage: https://github.com/guideline-tech/confg
|
|
88
81
|
licenses:
|
|
89
82
|
- MIT
|
|
90
|
-
metadata:
|
|
83
|
+
metadata:
|
|
84
|
+
allowed_push_host: https://rubygems.org
|
|
85
|
+
rubygems_mfa_required: 'true'
|
|
91
86
|
rdoc_options: []
|
|
92
87
|
require_paths:
|
|
93
88
|
- lib
|
|
@@ -102,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
102
97
|
- !ruby/object:Gem::Version
|
|
103
98
|
version: '0'
|
|
104
99
|
requirements: []
|
|
105
|
-
rubygems_version: 3.
|
|
100
|
+
rubygems_version: 3.7.2
|
|
106
101
|
specification_version: 4
|
|
107
102
|
summary: Sets shared variables for applications
|
|
108
103
|
test_files: []
|
data/.github/dependabot.yml
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: "github-actions"
|
|
4
|
-
directory: "/"
|
|
5
|
-
open-pull-requests-limit: 20
|
|
6
|
-
schedule:
|
|
7
|
-
interval: "daily"
|
|
8
|
-
time: "09:00"
|
|
9
|
-
timezone: "America/New_York"
|
|
10
|
-
commit-message:
|
|
11
|
-
prefix: "[github-actions] "
|
|
12
|
-
- package-ecosystem: "bundler"
|
|
13
|
-
directory: "/"
|
|
14
|
-
schedule:
|
|
15
|
-
interval: "daily"
|
|
16
|
-
time: "08:30"
|
|
17
|
-
timezone: "America/New_York"
|
|
18
|
-
versioning-strategy: increase
|
|
19
|
-
open-pull-requests-limit: 20
|
|
20
|
-
insecure-external-code-execution: deny
|
|
21
|
-
allow:
|
|
22
|
-
- dependency-type: "all"
|
|
23
|
-
commit-message:
|
|
24
|
-
prefix: "[bundler] "
|
data/.github/workflows/build.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: build
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
strategy:
|
|
11
|
-
fail-fast: false
|
|
12
|
-
matrix:
|
|
13
|
-
ruby-version: [3.2, 3.3, 3.4]
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
with:
|
|
17
|
-
show-progress: 'false'
|
|
18
|
-
- uses: ruby/setup-ruby@v1
|
|
19
|
-
with:
|
|
20
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
21
|
-
bundler-cache: true # runs `bundle install` and caches installed gems automatically
|
|
22
|
-
- run: bundle exec rake
|
data/.gitignore
DELETED
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.3.7
|
data/Gemfile
DELETED
data/README.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Confg
|
|
2
|
-
|
|
3
|
-
Provides a utility for loading and managing configurations for your ruby project.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
Set specific keys:
|
|
8
|
-
|
|
9
|
-
Confg.configure do |c|
|
|
10
|
-
c.foo_setting = 100
|
|
11
|
-
c.bar_setting = "yes"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Supports nesting:
|
|
15
|
-
|
|
16
|
-
Confg.configure do |c|
|
|
17
|
-
c.api_keys do |a|
|
|
18
|
-
a.google = 'xyz'
|
|
19
|
-
a.mixpanel = 'abc'
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
Load a yaml file:
|
|
24
|
-
|
|
25
|
-
Confg.configure do |c|
|
|
26
|
-
c.load_yaml "/path/to/file.yml"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
Yaml files can be namespaced by environment and contain ERB.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
development:
|
|
33
|
-
thing: <%= ENV["THING"] %>
|
|
34
|
-
staging:
|
|
35
|
-
thing: 'set value'
|
|
36
|
-
|
|
37
|
-
Use the values:
|
|
38
|
-
|
|
39
|
-
Confg.foo_setting
|
|
40
|
-
#=> 100
|
|
41
|
-
|
|
42
|
-
Confg.api_keys
|
|
43
|
-
#=> #<Confg::Configuration { "google" => "xyz", "mixpanel" => "abc" }>
|
|
44
|
-
|
|
45
|
-
Confg.api_keys.google # => "xyz"'
|
|
46
|
-
|
|
47
|
-
Confg.api_keys.to_h
|
|
48
|
-
#=> { "google" => "xyz", "mixpanel" => "abc" }
|
|
49
|
-
|
|
50
|
-
Confg.missing_key
|
|
51
|
-
#=> raises KeyError
|
|
52
|
-
|
|
53
|
-
Conf[:missing_key]
|
|
54
|
-
#=> nil
|
data/Rakefile
DELETED