environment_config 1.5.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +15 -2
- data/CHANGELOG.md +5 -0
- data/environment_config.gemspec +3 -2
- data/lib/environment_config/builder.rb +5 -5
- data/lib/environment_config/typed_env.rb +2 -2
- data/lib/environment_config/types.rb +4 -4
- data/lib/environment_config/version.rb +1 -1
- data/lib/environment_config.rb +1 -1
- metadata +7 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9309ff0522f135e768a568c6ed44becb8f91d81bbb86d28f37ced6ccfee4f6df
|
4
|
+
data.tar.gz: 38a2f3494e4c2699b475fdc4227686311c1ef283d58e970b2dc354a0cc85cd18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57268988b76a40ae1c1700c01545dbe81e4cc857c1b681ecf0b9dae06aa3d88cf0a53739d02c4594cef41911a1b259420ebe4b307b337c1ad63e8404cf7f7557
|
7
|
+
data.tar.gz: 70ad6af750dfd00a221fd49de79219dc47d6d053c65ca844da8dace36d4037a96912299402f3701b4a0bc761e3c8fe2d1d6f15b89f04e6cb51fa405ac88e7554
|
data/.gitlab-ci.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
image: ruby:
|
1
|
+
image: ruby:3.0
|
2
2
|
|
3
3
|
stages:
|
4
4
|
- test
|
@@ -13,7 +13,20 @@ rubocop:
|
|
13
13
|
script:
|
14
14
|
- bundle exec rubocop
|
15
15
|
|
16
|
-
|
16
|
+
rspec_3.0:
|
17
|
+
image: ruby:3.1
|
18
|
+
stage: test
|
19
|
+
script:
|
20
|
+
- bundle exec rspec
|
21
|
+
|
22
|
+
rspec_3.1:
|
23
|
+
image: ruby:3.1
|
24
|
+
stage: test
|
25
|
+
script:
|
26
|
+
- bundle exec rspec
|
27
|
+
|
28
|
+
rspec_latest:
|
29
|
+
image: ruby:latest
|
17
30
|
stage: test
|
18
31
|
script:
|
19
32
|
- bundle exec rspec
|
data/CHANGELOG.md
CHANGED
data/environment_config.gemspec
CHANGED
@@ -21,8 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.
|
24
|
+
spec.required_ruby_version = '~> 3.0'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'aroundhome_cops', '~> 5.0'
|
25
27
|
spec.add_development_dependency 'pry'
|
26
28
|
spec.add_development_dependency 'rspec', '~> 3.6'
|
27
|
-
spec.add_development_dependency 'rubocop', '0.86'
|
28
29
|
end
|
@@ -12,11 +12,11 @@ class EnvironmentConfig
|
|
12
12
|
@config = EnvironmentConfig.new
|
13
13
|
end
|
14
14
|
|
15
|
-
def method_missing(method_name, *args)
|
15
|
+
def method_missing(method_name, *args, **opts)
|
16
16
|
if Types.known_type?(method_name)
|
17
17
|
type = method_name
|
18
18
|
key = args.shift
|
19
|
-
convert_and_store(type, key, *args)
|
19
|
+
convert_and_store(type, key, *args, **opts)
|
20
20
|
else
|
21
21
|
super
|
22
22
|
end
|
@@ -28,13 +28,13 @@ class EnvironmentConfig
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def convert_and_store(type, key, *args)
|
32
|
-
value = TypedEnv.fetch(type, key, *args)
|
31
|
+
def convert_and_store(type, key, *args, **opts)
|
32
|
+
value = TypedEnv.fetch(type, key, *args, **opts)
|
33
33
|
store(key, value)
|
34
34
|
end
|
35
35
|
|
36
36
|
def store(key, value)
|
37
|
-
key = key[@strip_prefix.size
|
37
|
+
key = key[@strip_prefix.size..] if @strip_prefix && key.start_with?(@strip_prefix)
|
38
38
|
config.store(key.downcase, value)
|
39
39
|
end
|
40
40
|
end
|
@@ -7,8 +7,8 @@ require 'base64'
|
|
7
7
|
class EnvironmentConfig
|
8
8
|
class TypedEnv
|
9
9
|
class << self
|
10
|
-
def fetch(type, key, *args)
|
11
|
-
Types.convert(type, key, fetch_raw(key, *args))
|
10
|
+
def fetch(type, key, *args, **opts)
|
11
|
+
Types.convert(type, key, fetch_raw(key, *args, **opts))
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -30,9 +30,9 @@ class EnvironmentConfig
|
|
30
30
|
type.convert(value)
|
31
31
|
rescue Types::TypeError => e
|
32
32
|
raise ArgumentError,
|
33
|
-
"Environment variable #{key} could not be read as #{type_name}." \
|
34
|
-
"
|
35
|
-
"
|
33
|
+
"Environment variable #{key} could not be read as #{type_name}. " \
|
34
|
+
"Expected: #{e.expected_message} " \
|
35
|
+
"Got: #{e.value}"
|
36
36
|
end
|
37
37
|
|
38
38
|
def type_names
|
@@ -46,7 +46,7 @@ class EnvironmentConfig
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def type_map
|
49
|
-
@type_map ||= ALL.
|
49
|
+
@type_map ||= ALL.to_h { |type| [type.name, type] }
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/environment_config.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: environment_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- be Around GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aroundhome_cops
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.6'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.86'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.86'
|
69
55
|
description:
|
70
56
|
email:
|
71
57
|
- oss@aroundhome.de
|
@@ -108,17 +94,16 @@ require_paths:
|
|
108
94
|
- lib
|
109
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
96
|
requirements:
|
111
|
-
- - "
|
97
|
+
- - "~>"
|
112
98
|
- !ruby/object:Gem::Version
|
113
|
-
version: '0'
|
99
|
+
version: '3.0'
|
114
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
101
|
requirements:
|
116
102
|
- - ">="
|
117
103
|
- !ruby/object:Gem::Version
|
118
104
|
version: '0'
|
119
105
|
requirements: []
|
120
|
-
|
121
|
-
rubygems_version: 2.7.3
|
106
|
+
rubygems_version: 3.2.33
|
122
107
|
signing_key:
|
123
108
|
specification_version: 4
|
124
109
|
summary: Gem to unify reading configuration from env variables.
|