anyway_config 2.0.4 → 2.2.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/CHANGELOG.md +241 -181
- data/README.md +231 -13
- data/lib/.rbnext/1995.next/anyway/config.rb +438 -0
- data/lib/.rbnext/1995.next/anyway/dynamic_config.rb +31 -0
- data/lib/.rbnext/1995.next/anyway/env.rb +56 -0
- data/lib/.rbnext/1995.next/anyway/loaders/base.rb +21 -0
- data/lib/.rbnext/1995.next/anyway/tracing.rb +181 -0
- data/lib/.rbnext/2.7/anyway/auto_cast.rb +39 -19
- data/lib/.rbnext/2.7/anyway/config.rb +61 -16
- data/lib/.rbnext/2.7/anyway/rails/loaders/yaml.rb +30 -0
- data/lib/.rbnext/2.7/anyway/rbs.rb +92 -0
- data/lib/.rbnext/2.7/anyway/settings.rb +79 -0
- data/lib/.rbnext/2.7/anyway/tracing.rb +6 -6
- data/lib/.rbnext/2.7/anyway/type_casting.rb +130 -0
- data/lib/.rbnext/3.0/anyway/auto_cast.rb +53 -0
- data/lib/.rbnext/{2.8 → 3.0}/anyway/config.rb +61 -16
- data/lib/.rbnext/{2.8 → 3.0}/anyway/loaders/base.rb +0 -0
- data/lib/.rbnext/{2.8 → 3.0}/anyway/loaders.rb +0 -0
- data/lib/.rbnext/{2.8 → 3.0}/anyway/tracing.rb +6 -6
- data/lib/anyway/auto_cast.rb +39 -19
- data/lib/anyway/config.rb +75 -30
- data/lib/anyway/dynamic_config.rb +6 -2
- data/lib/anyway/env.rb +1 -1
- data/lib/anyway/ext/deep_dup.rb +12 -0
- data/lib/anyway/ext/hash.rb +10 -12
- data/lib/anyway/loaders/base.rb +1 -1
- data/lib/anyway/loaders/env.rb +3 -1
- data/lib/anyway/loaders/yaml.rb +9 -5
- data/lib/anyway/option_parser_builder.rb +1 -3
- data/lib/anyway/optparse_config.rb +5 -7
- data/lib/anyway/rails/loaders/credentials.rb +4 -4
- data/lib/anyway/rails/loaders/secrets.rb +6 -8
- data/lib/anyway/rails/loaders/yaml.rb +11 -0
- data/lib/anyway/rails/settings.rb +9 -2
- data/lib/anyway/rbs.rb +92 -0
- data/lib/anyway/settings.rb +52 -2
- data/lib/anyway/tracing.rb +9 -9
- data/lib/anyway/type_casting.rb +121 -0
- data/lib/anyway/utils/deep_merge.rb +21 -0
- data/lib/anyway/version.rb +1 -1
- data/lib/anyway_config.rb +4 -0
- data/sig/anyway_config.rbs +123 -0
- metadata +42 -15
- data/lib/.rbnext/2.7/anyway/option_parser_builder.rb +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87d32ae676d03c8a9fd3a0b22efe3321d76661f226438f52fd313f4d73b1876d
|
|
4
|
+
data.tar.gz: 82f2ab5d663b03622f650fbcf8e37216a71d81fdfd9270d54f539fd6253ada9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f7952609c7964cc9866fe530a9a519cf981f0551f9979c72f38b2acd31e59edd98d6234f095da99419acd462bcfc7c6b7d5016c41ded3bb0206d7f1e03550b3
|
|
7
|
+
data.tar.gz: 1559b8e140b7df15164134233fd6c65e11d9283f94c9495a0d92f6afdcc69271cec68a7bc6f5052b8ec06dab35e33f1cadd32f4f044701156bfcc0ca4676ba41
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## master
|
|
4
|
+
|
|
5
|
+
## 2.2.0 ⛓
|
|
6
|
+
|
|
7
|
+
- Add RBS signatures and generator. ([@palkan][])
|
|
8
|
+
|
|
9
|
+
Anyway Config now ships with the basic RBS support. To use config types with Steep, add `library "anyway_config"` to your Steepfile.
|
|
10
|
+
|
|
11
|
+
We also provide an API to generate a signature for you config class: `MyConfig.to_rbs`. You can use this method to generate a scaffold for your config class.
|
|
12
|
+
|
|
13
|
+
- Add type coercion support. ([@palkan][])
|
|
14
|
+
|
|
15
|
+
Example:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
class CoolConfig < Anyway::Config
|
|
19
|
+
attr_config :port, :user
|
|
20
|
+
|
|
21
|
+
coerce_types port: :string, user: {dob: :date}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
ENV["COOL_USER__DOB"] = "1989-07-01"
|
|
25
|
+
|
|
26
|
+
config = CoolConfig.new({port: 8080})
|
|
27
|
+
config.port == "8080" #=> true
|
|
28
|
+
config.user["dob"] == Date.new(1989, 7, 1) #=> true
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You can also add `.disable_auto_cast!` to your config class to disable automatic conversion.
|
|
32
|
+
|
|
33
|
+
**Warning** Now values from all sources are coerced (e.g., YAML files). That could lead to a different behaviour.
|
|
34
|
+
|
|
35
|
+
- Do not dup modules/classes passed as configuration values. ([@palkan][])
|
|
36
|
+
|
|
37
|
+
- Handle loading empty YAML config files. ([@micahlee][])
|
|
38
|
+
|
|
39
|
+
## 2.1.0 (2020-12-29)
|
|
40
|
+
|
|
41
|
+
- Drop deprecated `attr_config` instance variables support.
|
|
42
|
+
|
|
43
|
+
Config setters no longer write instance variables.
|
|
44
|
+
|
|
45
|
+
- Add `config.anyway_config.future` to allow enabling upcoming features. ([@palkan][])
|
|
46
|
+
|
|
47
|
+
For smoother upgrades, we provide a mechanism to opt-out to the new defaults beforehand.
|
|
48
|
+
Currently, only `:unwrap_known_environments` feature could be enabled (see below):
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
config.anyway_config.future.use :unwrap_known_environments
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- Allow to skip environment keys completely (e.g., `development:`, `test:`) in a config YML when used with Rails. In that case same config is loaded in all known environments (same mechanism as for non-Rails applications)
|
|
55
|
+
|
|
56
|
+
- Add the `known_environments` property to Anyway::Settings under Rails. Use `config.anyway_config.known_environments << "staging"` to make the gem aware of custom environments. ([@progapandist][])
|
|
57
|
+
|
|
58
|
+
- Make it possible to specify default YML configs directory. ([@palkan][])
|
|
59
|
+
|
|
60
|
+
For example:
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
Anyway::Settings.default_config_path = "path/to/configs"
|
|
64
|
+
|
|
65
|
+
# or in Rails
|
|
66
|
+
config.anyway_config.default_config_path = Rails.root.join("my/configs")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 2.0.6 (2020-07-7)
|
|
70
|
+
|
|
71
|
+
- Fix Ruby 2.7 warnings. ([@palkan][])
|
|
72
|
+
|
|
73
|
+
## 2.0.5 (2020-05-15)
|
|
74
|
+
|
|
75
|
+
- Use `YAML.load` instead of `YAML.safe_laad`. ([@palkan][])
|
|
76
|
+
|
|
3
77
|
## 2.0.4 (2020-05-15)
|
|
4
78
|
|
|
5
79
|
- Fix regression with adding `ruby-next` as a runtime dependency even for RubyGems release. ([@palkan][])
|
|
@@ -12,13 +86,13 @@
|
|
|
12
86
|
|
|
13
87
|
- Make sure configs are eager loaded in Rails when `config.eager_load = true`. ([@palkan][])
|
|
14
88
|
|
|
15
|
-
|
|
89
|
+
Fixes [#58](https://github.com/palkan/anyway_config/issues/58).
|
|
16
90
|
|
|
17
91
|
## 2.0.1 (2020-04-15)
|
|
18
92
|
|
|
19
93
|
- Fix loading Railtie when application has been already initialized. ([@palkan][])
|
|
20
94
|
|
|
21
|
-
|
|
95
|
+
Fixes [#56](https://github.com/palkan/anyway_config/issues/56).
|
|
22
96
|
|
|
23
97
|
## 2.0.0 (2020-04-14)
|
|
24
98
|
|
|
@@ -28,166 +102,166 @@
|
|
|
28
102
|
|
|
29
103
|
- Add predicate methods for attributes with boolean defaults. ([@palkan][])
|
|
30
104
|
|
|
31
|
-
|
|
105
|
+
For example:
|
|
32
106
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
107
|
+
```ruby
|
|
108
|
+
class MyConfig < Anyway::Config
|
|
109
|
+
attr_config :key, :secret, debug: false
|
|
110
|
+
end
|
|
37
111
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
112
|
+
MyConfig.new.debug? #=> false
|
|
113
|
+
MyConfig.new(debug: true).debug? #=> true
|
|
114
|
+
```
|
|
41
115
|
|
|
42
116
|
- Add `Config#deconstruct_keys`. ([@palkan][])
|
|
43
117
|
|
|
44
|
-
|
|
118
|
+
Now you can use configs in pattern matching:
|
|
45
119
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
120
|
+
```ruby
|
|
121
|
+
case AWSConfig.new
|
|
122
|
+
in bucket:, region: "eu-west-1"
|
|
123
|
+
setup_eu_storage(bucket)
|
|
124
|
+
in bucket:, region: "us-east-1"
|
|
125
|
+
setup_us_storage(bucket)
|
|
126
|
+
end
|
|
127
|
+
```
|
|
54
128
|
|
|
55
129
|
- Add pretty_print support. ([@palkan][])
|
|
56
130
|
|
|
57
|
-
|
|
58
|
-
|
|
131
|
+
Whenever you use `pp`, the output would contain pretty formatted config information
|
|
132
|
+
including the sources.
|
|
59
133
|
|
|
60
|
-
|
|
134
|
+
Example:
|
|
61
135
|
|
|
62
|
-
|
|
63
|
-
|
|
136
|
+
```ruby
|
|
137
|
+
pp CoolConfig.new
|
|
64
138
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
139
|
+
# #<CoolConfig
|
|
140
|
+
# config_name="cool"
|
|
141
|
+
# env_prefix="COOL"
|
|
142
|
+
# values:
|
|
143
|
+
# port => 3334 (type=load),
|
|
144
|
+
# host => "test.host" (type=yml path=./config/cool.yml),
|
|
145
|
+
# user =>
|
|
146
|
+
# name => "john" (type=env key=COOL_USER__NAME),
|
|
147
|
+
# password => "root" (type=yml path=./config/cool.yml)>
|
|
148
|
+
```
|
|
75
149
|
|
|
76
150
|
- Add source tracing support. ([@palkan][])
|
|
77
151
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
152
|
+
You can get the information on where a particular parameter value came from
|
|
153
|
+
(which loader) through via `#to_source_trace` method:
|
|
154
|
+
|
|
155
|
+
```ruby
|
|
156
|
+
conf = MyConfig.new
|
|
157
|
+
conf.to_source_trace
|
|
158
|
+
# {
|
|
159
|
+
# "host" => {value: "test.host", source: {type: :user, called_from: "/rails/root/config/application.rb:21"}},
|
|
160
|
+
# "user" => {
|
|
161
|
+
# "name" => {value: "john", source: {type: :env, key: "COOL_USER__NAME"}},
|
|
162
|
+
# "password" => {value: "root", source: {type: :yml, path: "config/cool.yml"}}
|
|
163
|
+
# },
|
|
164
|
+
# "port" => {value: 9292, source: {type: :defaults}}
|
|
165
|
+
# }
|
|
166
|
+
```
|
|
93
167
|
|
|
94
168
|
- Change the way Rails configs autoloading works. ([@palkan][])
|
|
95
169
|
|
|
96
|
-
|
|
97
|
-
|
|
170
|
+
In Rails 6, autoloading before initialization is [deprecated](https://github.com/rails/rails/commit/3e66ba91d511158e22f90ff96b594d61f40eda01). We can still
|
|
171
|
+
make it work by using our own autoloading mechanism (custom Zeitwerk loader).
|
|
98
172
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
173
|
+
This forces us to use a custom directory (not `app/`) for configs required at the boot time.
|
|
174
|
+
By default, we put _static_ configs into `config/configs` but you can still use `app/configs` for
|
|
175
|
+
_dynamic_ (runtime) configs.
|
|
102
176
|
|
|
103
|
-
|
|
104
|
-
|
|
177
|
+
**NOTE:** if you used `app/configs` with 2.0.0.preX and relied on configs during initialization,
|
|
178
|
+
you can set static configs path to `app/configs`:
|
|
105
179
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
180
|
+
```ruby
|
|
181
|
+
config.anyway_config.autoload_static_config_path = "app/configs"
|
|
182
|
+
```
|
|
109
183
|
|
|
110
|
-
|
|
184
|
+
You can do this by running the generator:
|
|
111
185
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
186
|
+
```sh
|
|
187
|
+
rails g anyway:install --configs-path=app/configs
|
|
188
|
+
```
|
|
115
189
|
|
|
116
190
|
- Add Rails generators. ([@palkan][])
|
|
117
191
|
|
|
118
|
-
|
|
192
|
+
You can create config classes with the predefined attributes like this:
|
|
119
193
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
194
|
+
```sh
|
|
195
|
+
rails generate config aws access_key_id secret_access_key region
|
|
196
|
+
```
|
|
123
197
|
|
|
124
198
|
- **BREAKING** The accessors generated by `attr_config` are not longer `attr_accessor`-s. ([@palkan][])
|
|
125
199
|
|
|
126
|
-
|
|
127
|
-
|
|
200
|
+
You cannot rely on instance variables anymore. Instead, you can use `super` when overriding accessors or
|
|
201
|
+
`values[name]`:
|
|
128
202
|
|
|
129
|
-
|
|
130
|
-
|
|
203
|
+
```ruby
|
|
204
|
+
attr_config :host, :port, :url, :meta
|
|
131
205
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
206
|
+
# override writer to handle type coercion
|
|
207
|
+
def meta=(val)
|
|
208
|
+
super JSON.parse(val)
|
|
209
|
+
end
|
|
136
210
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
211
|
+
# or override reader to handle missing values
|
|
212
|
+
def url
|
|
213
|
+
values[:url] ||= "#{host}:#{port}"
|
|
214
|
+
end
|
|
141
215
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
216
|
+
# in <2.1 it's still possible to read instance variables,
|
|
217
|
+
# i.e. the following would also work
|
|
218
|
+
def url
|
|
219
|
+
@url ||= "#{host}:#{port}"
|
|
220
|
+
end
|
|
221
|
+
```
|
|
148
222
|
|
|
149
|
-
|
|
150
|
-
|
|
223
|
+
**NOTE**: we still set instance variables in writers (for backward compatibility), but that would
|
|
224
|
+
be removed in 2.1.
|
|
151
225
|
|
|
152
226
|
- Add `Config#dig` method. ([@palkan][])
|
|
153
227
|
|
|
154
228
|
- Add ability to specify types for OptionParser options. ([@palkan][])
|
|
155
229
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
230
|
+
```ruby
|
|
231
|
+
describe_options(
|
|
232
|
+
concurrency: {
|
|
233
|
+
desc: "number of threads to use",
|
|
234
|
+
type: String
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
```
|
|
164
238
|
|
|
165
239
|
- Add param presence validation. ([@palkan][])
|
|
166
240
|
|
|
167
|
-
|
|
168
|
-
|
|
241
|
+
You can specify some params as required, and the validation
|
|
242
|
+
error would be raised if they're missing or empty (only for strings):
|
|
169
243
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
244
|
+
```ruby
|
|
245
|
+
class MyConfig < Anyway::Config
|
|
246
|
+
attr_config :api_key, :api_secret, :debug
|
|
173
247
|
|
|
174
|
-
|
|
175
|
-
|
|
248
|
+
required :api_key, :api_secret
|
|
249
|
+
end
|
|
176
250
|
|
|
177
|
-
|
|
178
|
-
|
|
251
|
+
MyConfig.new(api_secret: "") #=> raises Anyway::Config::ValidationError
|
|
252
|
+
```
|
|
179
253
|
|
|
180
|
-
|
|
254
|
+
You can change the validation behaviour by overriding the `#validate!` method in your config class.
|
|
181
255
|
|
|
182
256
|
- Validate config attribute names. ([@palkan][])
|
|
183
257
|
|
|
184
|
-
|
|
185
|
-
|
|
258
|
+
Do not allow using reserved names (`Anyway::Config` method names).
|
|
259
|
+
Allow only alphanumeric names (matching `/^[a-z_]([\w]+)?$/`).
|
|
186
260
|
|
|
187
261
|
- Add Loaders API. ([@palkan][])
|
|
188
262
|
|
|
189
|
-
|
|
190
|
-
|
|
263
|
+
All config sources have standardized via _loaders_ API. It's possible to define
|
|
264
|
+
custom loaders or change the sources order.
|
|
191
265
|
|
|
192
266
|
## 2.0.0.pre2 (2019-04-26)
|
|
193
267
|
|
|
@@ -197,73 +271,58 @@
|
|
|
197
271
|
|
|
198
272
|
- **BREAKING** Changed the way of providing explicit values. ([@palkan][])
|
|
199
273
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
274
|
+
```ruby
|
|
275
|
+
# BEFORE
|
|
276
|
+
Config.new(overrides: data)
|
|
203
277
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
278
|
+
# AFTER
|
|
279
|
+
Config.new(data)
|
|
280
|
+
```
|
|
207
281
|
|
|
208
282
|
- Add Railtie. ([@palkan][])
|
|
209
283
|
|
|
210
|
-
|
|
284
|
+
`Anyway::Railtie` provides `Anyway::Settings` access via `Rails.applicaiton.configuration.anyway_config`.
|
|
211
285
|
|
|
212
|
-
|
|
213
|
-
|
|
286
|
+
It also adds `app/configs` path to autoload paths (low-level, `ActiveSupport::Dependencies`) to
|
|
287
|
+
make it possible to use configs in the app configuration files.
|
|
214
288
|
|
|
215
289
|
- Add test helpers. ([@palkan][])
|
|
216
290
|
|
|
217
|
-
|
|
218
|
-
|
|
291
|
+
Added `with_env` helper to test code in the context of the specified
|
|
292
|
+
environment variables.
|
|
219
293
|
|
|
220
|
-
|
|
221
|
-
|
|
294
|
+
Included automatically in RSpec for examples with the `type: :config` meta
|
|
295
|
+
or with the `spec/configs` path.
|
|
222
296
|
|
|
223
297
|
- Add support for _local_ files. ([@palkan][])
|
|
224
298
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
299
|
+
Now users can store their personal configurations in _local_ files:
|
|
300
|
+
|
|
301
|
+
- `<config_name>.local.yml`
|
|
302
|
+
- `config/credentials/local.yml.enc` (for Rails 6).
|
|
228
303
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
304
|
+
Local configs are meant for using in development and only loaded if
|
|
305
|
+
`Anyway::Settings.use_local_files` is `true` (which is true by default if
|
|
306
|
+
`RACK_ENV` or `RAILS_ENV` env variable is equal to `"development"`).
|
|
232
307
|
|
|
233
308
|
- Add Rails credentials support. ([@palkan][])
|
|
234
309
|
|
|
235
|
-
|
|
236
|
-
|
|
310
|
+
The data from credentials is loaded after the data from YAML config and secrets,
|
|
311
|
+
but before environmental variables (i.e. env variables are _stronger_)
|
|
237
312
|
|
|
238
313
|
- Update config name inference logic. ([@palkan][])
|
|
239
314
|
|
|
240
|
-
|
|
241
|
-
- the class name has a form of `<Module>::Config` (`SomeModule::Config => "some_module"`)
|
|
242
|
-
- the class name has a form of `<Something>Config` (`SomeConfig => "some"`)
|
|
243
|
-
|
|
244
|
-
- Fix config classes inheritance. ([@palkan][])
|
|
315
|
+
Config name is automatically inferred only if:
|
|
245
316
|
|
|
246
|
-
|
|
247
|
-
|
|
317
|
+
- the class name has a form of `<Module>::Config` (`SomeModule::Config => "some_module"`)
|
|
318
|
+
- the class name has a form of `<Something>Config` (`SomeConfig => "some"`)
|
|
248
319
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
Noticeable features:
|
|
252
|
-
- if `config_name` is explicitly defined on class, it's inherited by subclasses:
|
|
253
|
-
|
|
254
|
-
```ruby
|
|
255
|
-
class MyAppBaseConfig < Anyway::Config
|
|
256
|
-
config_name :my_app
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
class MyServiceConfig < MyAppBaseConfig
|
|
260
|
-
end
|
|
320
|
+
- Fix config classes inheritance. ([@palkan][])
|
|
261
321
|
|
|
262
|
-
|
|
263
|
-
|
|
322
|
+
Previously, inheritance didn't work due to the lack of proper handling of class-level
|
|
323
|
+
configuration (naming, option parses settings, defaults).
|
|
264
324
|
|
|
265
|
-
|
|
266
|
-
- option parse extension are not overriden, but added to the parent class extensions
|
|
325
|
+
Now it's possible to extend config classes without breaking the original classes functionality.
|
|
267
326
|
|
|
268
327
|
- **Require Ruby >= 2.5.0.**
|
|
269
328
|
|
|
@@ -283,26 +342,26 @@
|
|
|
283
342
|
|
|
284
343
|
- Add OptionParse integration ([@jastkand][])
|
|
285
344
|
|
|
286
|
-
|
|
345
|
+
See more [PR#18](https://github.com/palkan/anyway_config/pull/18).
|
|
287
346
|
|
|
288
347
|
- Use underscored config name as an env prefix. ([@palkan][])
|
|
289
348
|
|
|
290
|
-
|
|
349
|
+
For a config class:
|
|
291
350
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
351
|
+
```ruby
|
|
352
|
+
class MyApp < Anyway::Config
|
|
353
|
+
end
|
|
354
|
+
```
|
|
296
355
|
|
|
297
|
-
|
|
356
|
+
Before this change we use `MYAPP_` prefix, now it's `MY_APP_`.
|
|
298
357
|
|
|
299
|
-
|
|
358
|
+
You can specify the prefix explicitly:
|
|
300
359
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
360
|
+
```ruby
|
|
361
|
+
class MyApp < Anyway::Config
|
|
362
|
+
env_prefix "MYAPP_"
|
|
363
|
+
end
|
|
364
|
+
```
|
|
306
365
|
|
|
307
366
|
## 1.3.0 (2018-06-15)
|
|
308
367
|
|
|
@@ -318,18 +377,18 @@ Now works on JRuby 9.1+.
|
|
|
318
377
|
|
|
319
378
|
- Allow to pass raw hash with explicit values to `Config.new`. ([@dsalahutdinov][])
|
|
320
379
|
|
|
321
|
-
|
|
380
|
+
Example:
|
|
322
381
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
382
|
+
```ruby
|
|
383
|
+
Sniffer::Config.new(
|
|
384
|
+
overrides: {
|
|
385
|
+
enabled: true,
|
|
386
|
+
storage: {capacity: 500}
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
```
|
|
331
390
|
|
|
332
|
-
|
|
391
|
+
See more [PR#10](https://github.com/palkan/anyway_config/pull/10).
|
|
333
392
|
|
|
334
393
|
## 1.1.2 (2017-11-19)
|
|
335
394
|
|
|
@@ -343,7 +402,7 @@ Now works on JRuby 9.1+.
|
|
|
343
402
|
|
|
344
403
|
- Add `#to_h` method. ([@palkan][])
|
|
345
404
|
|
|
346
|
-
|
|
405
|
+
See [#4](https://github.com/palkan/anyway_config/issues/4).
|
|
347
406
|
|
|
348
407
|
- Make it possible to extend configuration parameters. ([@palkan][])
|
|
349
408
|
|
|
@@ -357,17 +416,18 @@ Now works on JRuby 9.1+.
|
|
|
357
416
|
|
|
358
417
|
- Drop `active_support` dependency. ([@palkan][])
|
|
359
418
|
|
|
360
|
-
|
|
419
|
+
Use custom refinements instead of requiring `active_support`.
|
|
361
420
|
|
|
362
|
-
|
|
421
|
+
No we're dependency-free!
|
|
363
422
|
|
|
364
423
|
## 0.1.0 (2015-01-20)
|
|
365
424
|
|
|
366
|
-
|
|
425
|
+
- Initial version.
|
|
367
426
|
|
|
368
427
|
[@palkan]: https://github.com/palkan
|
|
369
428
|
[@onemanstartup]: https://github.com/onemanstartup
|
|
370
429
|
[@dsalahutdinov]: https://github.com/dsalahutdinov
|
|
371
430
|
[@charlie-wasp]: https://github.com/charlie-wasp
|
|
372
431
|
[@jastkand]: https://github.com/jastkand
|
|
373
|
-
[@
|
|
432
|
+
[@envek]: https://github.com/Envek
|
|
433
|
+
[@progapandist]: https://github.com/progapandist
|