runger_config 2.6.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 +7 -0
- data/CHANGELOG.md +562 -0
- data/LICENSE.txt +22 -0
- data/README.md +1121 -0
- data/lib/anyway/auto_cast.rb +53 -0
- data/lib/anyway/config.rb +473 -0
- data/lib/anyway/dynamic_config.rb +31 -0
- data/lib/anyway/ejson_parser.rb +40 -0
- data/lib/anyway/env.rb +73 -0
- data/lib/anyway/ext/deep_dup.rb +48 -0
- data/lib/anyway/ext/deep_freeze.rb +44 -0
- data/lib/anyway/ext/flatten_names.rb +37 -0
- data/lib/anyway/ext/hash.rb +40 -0
- data/lib/anyway/ext/string_constantize.rb +24 -0
- data/lib/anyway/loaders/base.rb +21 -0
- data/lib/anyway/loaders/doppler.rb +63 -0
- data/lib/anyway/loaders/ejson.rb +89 -0
- data/lib/anyway/loaders/env.rb +18 -0
- data/lib/anyway/loaders/yaml.rb +84 -0
- data/lib/anyway/loaders.rb +79 -0
- data/lib/anyway/option_parser_builder.rb +29 -0
- data/lib/anyway/optparse_config.rb +92 -0
- data/lib/anyway/rails/autoload.rb +42 -0
- data/lib/anyway/rails/config.rb +23 -0
- data/lib/anyway/rails/loaders/credentials.rb +64 -0
- data/lib/anyway/rails/loaders/secrets.rb +37 -0
- data/lib/anyway/rails/loaders/yaml.rb +9 -0
- data/lib/anyway/rails/loaders.rb +5 -0
- data/lib/anyway/rails/settings.rb +83 -0
- data/lib/anyway/rails.rb +24 -0
- data/lib/anyway/railtie.rb +28 -0
- data/lib/anyway/rbs.rb +92 -0
- data/lib/anyway/settings.rb +111 -0
- data/lib/anyway/testing/helpers.rb +36 -0
- data/lib/anyway/testing.rb +13 -0
- data/lib/anyway/tracing.rb +188 -0
- data/lib/anyway/type_casting.rb +144 -0
- data/lib/anyway/utils/deep_merge.rb +21 -0
- data/lib/anyway/utils/which.rb +18 -0
- data/lib/anyway/version.rb +5 -0
- data/lib/anyway.rb +3 -0
- data/lib/anyway_config.rb +54 -0
- data/lib/generators/anyway/app_config/USAGE +9 -0
- data/lib/generators/anyway/app_config/app_config_generator.rb +17 -0
- data/lib/generators/anyway/config/USAGE +13 -0
- data/lib/generators/anyway/config/config_generator.rb +51 -0
- data/lib/generators/anyway/config/templates/config.rb.tt +12 -0
- data/lib/generators/anyway/config/templates/config.yml.tt +13 -0
- data/lib/generators/anyway/install/USAGE +4 -0
- data/lib/generators/anyway/install/install_generator.rb +47 -0
- data/lib/generators/anyway/install/templates/application_config.rb.tt +17 -0
- data/sig/anyway_config.rbs +149 -0
- data/sig/manifest.yml +6 -0
- metadata +202 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6dd3b9e8a53894c367009b4ce3e15ce9f6a178d4288572c7ba0551dbdc2244d0
|
4
|
+
data.tar.gz: d20a48187b7ad307eb0ce9ae1a7cfa5f6ef9b8dce97b95576e59ba2cf829e1e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b44be9da2bf7ad76e767ecf85ff9aff9c69208754a19bc515d5d5844ad65ed9500cb9f70ccdf46b50bc30e7572f0adc62d86026a88642c1c50b6f6096260801
|
7
|
+
data.tar.gz: 38af17f45c96347c2e6dabaa9c115dcac7fdf1b720f65138c425823e48eac602690a9707aed8cd4e8829dd6a3d80634779863a8d8a34474b2d2494a100393bf8
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,562 @@
|
|
1
|
+
# Change log
|
2
|
+
|
3
|
+
## v2.6.0 (2023-11-19)
|
4
|
+
|
5
|
+
- Don't deep stringify keys
|
6
|
+
|
7
|
+
## 2.5.4 (2023-10-15)
|
8
|
+
|
9
|
+
- Fix tracing with empty config keys. ([@palkan][])
|
10
|
+
|
11
|
+
## 2.5.3 (2023-09-12)
|
12
|
+
|
13
|
+
- Do not activate Rails secrets loaders in 7.1+. ([@palkan][])
|
14
|
+
|
15
|
+
- Set `use_local_files` depending on `Rails.env`. ([@marshall-lee][])
|
16
|
+
|
17
|
+
## 2.5.2 (2023-08-23)
|
18
|
+
|
19
|
+
- Disable Rails post-load detection in TruffleRuby. ([@palkan][])
|
20
|
+
|
21
|
+
## 2.5.1 (2023-08-04)
|
22
|
+
|
23
|
+
- Fix Rails detection. ([@palkan][])
|
24
|
+
|
25
|
+
Fixes [#134](https://github.com/palkan/anyway_config/issues/134).
|
26
|
+
|
27
|
+
## 2.5.0 (2023-07-24)
|
28
|
+
|
29
|
+
- Generators: Add `config_name` to generated classes if name contains underscore. ([@palkan][])
|
30
|
+
|
31
|
+
- Load Rails extensions even if Rails was loaded after Anyway Config. ([@palkan][])
|
32
|
+
|
33
|
+
- Fix handling `config.credentials.content_path` provided as String. ([@palkan][])
|
34
|
+
|
35
|
+
## 2.4.2 (2023-06-07)
|
36
|
+
|
37
|
+
- Use ANYWAY_ENV as the current environment if defined. ([@palkan][])
|
38
|
+
|
39
|
+
It can be used to specify environment for configs independently of Rails environment.
|
40
|
+
|
41
|
+
## 2.4.1 (2023-05-04)
|
42
|
+
|
43
|
+
- Add custom namespace support via `ejson_namespace` ([@bessey])
|
44
|
+
|
45
|
+
- Add arbitrary custom loader options support via `loader_options` ([@bessey])
|
46
|
+
|
47
|
+
## 2.4.0 (2023-04-04)
|
48
|
+
|
49
|
+
- Added `Confi#as_env` to convert config into a ENV-like Hash. ([@tagirahmad][])
|
50
|
+
|
51
|
+
- Added experimental support for sub-configs via coercion. ([@palkan][])
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
class AnotherConfig < Anyway::Config
|
55
|
+
attr_config foo: "bar"
|
56
|
+
end
|
57
|
+
|
58
|
+
class MyConfig < Anyway::Config
|
59
|
+
attr_config :another_config
|
60
|
+
|
61
|
+
coerce_types another_config: "AnotherConfig"
|
62
|
+
end
|
63
|
+
|
64
|
+
MyConfig.new.another_config.foo #=> "bar"
|
65
|
+
|
66
|
+
ENV["MY_ANOTHER_CONFIG__FOO"] = "baz"
|
67
|
+
MyConfig.new.another_config.foo #=> "baz"
|
68
|
+
```
|
69
|
+
|
70
|
+
- Define predicate methods when `:boolean` type is specified for the attribute. ([@palkan][])
|
71
|
+
|
72
|
+
- Add support for nested required config attributes. ([@palkan][])
|
73
|
+
|
74
|
+
The API is inspired by Rails permitted params:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
class AppConfig < Anyway::Config
|
78
|
+
attr_config :assets_host, database: {host: nil, port: nil}
|
79
|
+
|
80
|
+
required :assets_host, database: [:host, :port]
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
- Add support for using `env_prefix ""` to load from unprefixed env vars. ([@palkan][])
|
85
|
+
|
86
|
+
See [#118](https://github.com/palkan/anyway_config/issues/118).
|
87
|
+
|
88
|
+
- Added EJSON support. ([@inner-whisper])
|
89
|
+
|
90
|
+
- Add Doppler loader. ([@prog-supdex][]).
|
91
|
+
|
92
|
+
## 2.3.1 (2023-01-17)
|
93
|
+
|
94
|
+
- [Fixes [#110](https://github.com/palkan/anyway_config/issues/110)] Fix setting up autoloader for the same folder. ([@palkan][])
|
95
|
+
|
96
|
+
- RBS: Now `.on_load` automatically pass block context type (instance), so no need to add annotations! ([@palkan][])
|
97
|
+
|
98
|
+
Steep 1.2+ is required. Read more about the [feature](https://hackmd.io/xLrYaqUtQ1GhgTHODkYypw?view).
|
99
|
+
|
100
|
+
- Added `manifest.yml` for RBS. ([@palkan][])
|
101
|
+
|
102
|
+
## 2.3.0 (2022-03-11)
|
103
|
+
|
104
|
+
- Add ability to load configurations under specific environments in pure Ruby apps. ([@fargelus][]).
|
105
|
+
|
106
|
+
Before loading environment configurations you need to specify variable `Anyway::Settings.current_environment`. In Rails apps this variable is same as `Rails.env` value.
|
107
|
+
After adding yaml loader will try to load params under this environment.
|
108
|
+
|
109
|
+
Also required env option was added to `Anyway::Config`.
|
110
|
+
|
111
|
+
## 2.2.3 (2022-01-21)
|
112
|
+
|
113
|
+
- Fix Ruby 3.1 compatibility. ([@palkan][])
|
114
|
+
|
115
|
+
- Add ability to set default key for environmental YAML files. ([@skryukov])
|
116
|
+
|
117
|
+
Define a key for environmental yaml files to read default values from with `config.anyway_config.default_environmental_key = "default"`.
|
118
|
+
This way Anyway Config will try to read settings under the `"default"` key and then merge environmental settings into them.
|
119
|
+
|
120
|
+
## 2.2.2 (2020-10-26)
|
121
|
+
|
122
|
+
- Fixed regression introduced by the `#deep_merge!` refinement.
|
123
|
+
|
124
|
+
## 2.2.1 (2020-09-28)
|
125
|
+
|
126
|
+
- Minor fixes to the prev release.
|
127
|
+
|
128
|
+
## 2.2.0 ⛓ (2020-09-28)
|
129
|
+
|
130
|
+
- Add RBS signatures and generator. ([@palkan][])
|
131
|
+
|
132
|
+
Anyway Config now ships with the basic RBS support. To use config types with Steep, add `library "anyway_config"` to your Steepfile.
|
133
|
+
|
134
|
+
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.
|
135
|
+
|
136
|
+
- Add type coercion support. ([@palkan][])
|
137
|
+
|
138
|
+
Example:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
class CoolConfig < Anyway::Config
|
142
|
+
attr_config :port, :user
|
143
|
+
|
144
|
+
coerce_types port: :string, user: {dob: :date}
|
145
|
+
end
|
146
|
+
|
147
|
+
ENV["COOL_USER__DOB"] = "1989-07-01"
|
148
|
+
|
149
|
+
config = CoolConfig.new({port: 8080})
|
150
|
+
config.port == "8080" #=> true
|
151
|
+
config.user["dob"] == Date.new(1989, 7, 1) #=> true
|
152
|
+
```
|
153
|
+
|
154
|
+
You can also add `.disable_auto_cast!` to your config class to disable automatic conversion.
|
155
|
+
|
156
|
+
**Warning** Now values from all sources are coerced (e.g., YAML files). That could lead to a different behaviour.
|
157
|
+
|
158
|
+
- Do not dup modules/classes passed as configuration values. ([@palkan][])
|
159
|
+
|
160
|
+
- Handle loading empty YAML config files. ([@micahlee][])
|
161
|
+
|
162
|
+
## 2.1.0 (2020-12-29)
|
163
|
+
|
164
|
+
- Drop deprecated `attr_config` instance variables support.
|
165
|
+
|
166
|
+
Config setters no longer write instance variables.
|
167
|
+
|
168
|
+
- Add `config.anyway_config.future` to allow enabling upcoming features. ([@palkan][])
|
169
|
+
|
170
|
+
For smoother upgrades, we provide a mechanism to opt-out to the new defaults beforehand.
|
171
|
+
Currently, only `:unwrap_known_environments` feature could be enabled (see below):
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
config.anyway_config.future.use :unwrap_known_environments
|
175
|
+
```
|
176
|
+
|
177
|
+
- 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)
|
178
|
+
|
179
|
+
- 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][])
|
180
|
+
|
181
|
+
- Make it possible to specify default YML configs directory. ([@palkan][])
|
182
|
+
|
183
|
+
For example:
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
Anyway::Settings.default_config_path = "path/to/configs"
|
187
|
+
|
188
|
+
# or in Rails
|
189
|
+
config.anyway_config.default_config_path = Rails.root.join("my/configs")
|
190
|
+
```
|
191
|
+
|
192
|
+
## 2.0.6 (2020-07-7)
|
193
|
+
|
194
|
+
- Fix Ruby 2.7 warnings. ([@palkan][])
|
195
|
+
|
196
|
+
## 2.0.5 (2020-05-15)
|
197
|
+
|
198
|
+
- Use `YAML.load` instead of `YAML.safe_laad`. ([@palkan][])
|
199
|
+
|
200
|
+
## 2.0.4 (2020-05-15)
|
201
|
+
|
202
|
+
- Fix regression with adding `ruby-next` as a runtime dependency even for RubyGems release. ([@palkan][])
|
203
|
+
|
204
|
+
## 2.0.3 (2020-05-12)
|
205
|
+
|
206
|
+
- Enable [auto-transpiling](https://github.com/ruby-next/ruby-next#transpiled-files-vs-vcs-vs-installing-from-source) to allow installing from source. ([@palkan][])
|
207
|
+
|
208
|
+
## 2.0.2 (2020-04-24)
|
209
|
+
|
210
|
+
- Make sure configs are eager loaded in Rails when `config.eager_load = true`. ([@palkan][])
|
211
|
+
|
212
|
+
Fixes [#58](https://github.com/palkan/anyway_config/issues/58).
|
213
|
+
|
214
|
+
## 2.0.1 (2020-04-15)
|
215
|
+
|
216
|
+
- Fix loading Railtie when application has been already initialized. ([@palkan][])
|
217
|
+
|
218
|
+
Fixes [#56](https://github.com/palkan/anyway_config/issues/56).
|
219
|
+
|
220
|
+
## 2.0.0 (2020-04-14)
|
221
|
+
|
222
|
+
- Fix double `yield` in tracing for ENV loader. ([@Envek][])
|
223
|
+
|
224
|
+
## 2.0.0.rc1 (2020-03-31)
|
225
|
+
|
226
|
+
- Add predicate methods for attributes with boolean defaults. ([@palkan][])
|
227
|
+
|
228
|
+
For example:
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
class MyConfig < Anyway::Config
|
232
|
+
attr_config :key, :secret, debug: false
|
233
|
+
end
|
234
|
+
|
235
|
+
MyConfig.new.debug? #=> false
|
236
|
+
MyConfig.new(debug: true).debug? #=> true
|
237
|
+
```
|
238
|
+
|
239
|
+
- Add `Config#deconstruct_keys`. ([@palkan][])
|
240
|
+
|
241
|
+
Now you can use configs in pattern matching:
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
case AWSConfig.new
|
245
|
+
in bucket:, region: "eu-west-1"
|
246
|
+
setup_eu_storage(bucket)
|
247
|
+
in bucket:, region: "us-east-1"
|
248
|
+
setup_us_storage(bucket)
|
249
|
+
end
|
250
|
+
```
|
251
|
+
|
252
|
+
- Add pretty_print support. ([@palkan][])
|
253
|
+
|
254
|
+
Whenever you use `pp`, the output would contain pretty formatted config information
|
255
|
+
including the sources.
|
256
|
+
|
257
|
+
Example:
|
258
|
+
|
259
|
+
```ruby
|
260
|
+
pp CoolConfig.new
|
261
|
+
|
262
|
+
# #<CoolConfig
|
263
|
+
# config_name="cool"
|
264
|
+
# env_prefix="COOL"
|
265
|
+
# values:
|
266
|
+
# port => 3334 (type=load),
|
267
|
+
# host => "test.host" (type=yml path=./config/cool.yml),
|
268
|
+
# user =>
|
269
|
+
# name => "john" (type=env key=COOL_USER__NAME),
|
270
|
+
# password => "root" (type=yml path=./config/cool.yml)>
|
271
|
+
```
|
272
|
+
|
273
|
+
- Add source tracing support. ([@palkan][])
|
274
|
+
|
275
|
+
You can get the information on where a particular parameter value came from
|
276
|
+
(which loader) through via `#to_source_trace` method:
|
277
|
+
|
278
|
+
```ruby
|
279
|
+
conf = MyConfig.new
|
280
|
+
conf.to_source_trace
|
281
|
+
# {
|
282
|
+
# "host" => {value: "test.host", source: {type: :user, called_from: "/rails/root/config/application.rb:21"}},
|
283
|
+
# "user" => {
|
284
|
+
# "name" => {value: "john", source: {type: :env, key: "COOL_USER__NAME"}},
|
285
|
+
# "password" => {value: "root", source: {type: :yml, path: "config/cool.yml"}}
|
286
|
+
# },
|
287
|
+
# "port" => {value: 9292, source: {type: :defaults}}
|
288
|
+
# }
|
289
|
+
```
|
290
|
+
|
291
|
+
- Change the way Rails configs autoloading works. ([@palkan][])
|
292
|
+
|
293
|
+
In Rails 6, autoloading before initialization is [deprecated](https://github.com/rails/rails/commit/3e66ba91d511158e22f90ff96b594d61f40eda01). We can still
|
294
|
+
make it work by using our own autoloading mechanism (custom Zeitwerk loader).
|
295
|
+
|
296
|
+
This forces us to use a custom directory (not `app/`) for configs required at the boot time.
|
297
|
+
By default, we put _static_ configs into `config/configs` but you can still use `app/configs` for
|
298
|
+
_dynamic_ (runtime) configs.
|
299
|
+
|
300
|
+
**NOTE:** if you used `app/configs` with 2.0.0.preX and relied on configs during initialization,
|
301
|
+
you can set static configs path to `app/configs`:
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
config.anyway_config.autoload_static_config_path = "app/configs"
|
305
|
+
```
|
306
|
+
|
307
|
+
You can do this by running the generator:
|
308
|
+
|
309
|
+
```sh
|
310
|
+
rails g anyway:install --configs-path=app/configs
|
311
|
+
```
|
312
|
+
|
313
|
+
- Add Rails generators. ([@palkan][])
|
314
|
+
|
315
|
+
You can create config classes with the predefined attributes like this:
|
316
|
+
|
317
|
+
```sh
|
318
|
+
rails generate config aws access_key_id secret_access_key region
|
319
|
+
```
|
320
|
+
|
321
|
+
- **BREAKING** The accessors generated by `attr_config` are not longer `attr_accessor`-s. ([@palkan][])
|
322
|
+
|
323
|
+
You cannot rely on instance variables anymore. Instead, you can use `super` when overriding accessors or
|
324
|
+
`values[name]`:
|
325
|
+
|
326
|
+
```ruby
|
327
|
+
attr_config :host, :port, :url, :meta
|
328
|
+
|
329
|
+
# override writer to handle type coercion
|
330
|
+
def meta=(val)
|
331
|
+
super JSON.parse(val)
|
332
|
+
end
|
333
|
+
|
334
|
+
# or override reader to handle missing values
|
335
|
+
def url
|
336
|
+
values[:url] ||= "#{host}:#{port}"
|
337
|
+
end
|
338
|
+
|
339
|
+
# in <2.1 it's still possible to read instance variables,
|
340
|
+
# i.e. the following would also work
|
341
|
+
def url
|
342
|
+
@url ||= "#{host}:#{port}"
|
343
|
+
end
|
344
|
+
```
|
345
|
+
|
346
|
+
**NOTE**: we still set instance variables in writers (for backward compatibility), but that would
|
347
|
+
be removed in 2.1.
|
348
|
+
|
349
|
+
- Add `Config#dig` method. ([@palkan][])
|
350
|
+
|
351
|
+
- Add ability to specify types for OptionParser options. ([@palkan][])
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
describe_options(
|
355
|
+
concurrency: {
|
356
|
+
desc: "number of threads to use",
|
357
|
+
type: String
|
358
|
+
}
|
359
|
+
)
|
360
|
+
```
|
361
|
+
|
362
|
+
- Add param presence validation. ([@palkan][])
|
363
|
+
|
364
|
+
You can specify some params as required, and the validation
|
365
|
+
error would be raised if they're missing or empty (only for strings):
|
366
|
+
|
367
|
+
```ruby
|
368
|
+
class MyConfig < Anyway::Config
|
369
|
+
attr_config :api_key, :api_secret, :debug
|
370
|
+
|
371
|
+
required :api_key, :api_secret
|
372
|
+
end
|
373
|
+
|
374
|
+
MyConfig.new(api_secret: "") #=> raises Anyway::Config::ValidationError
|
375
|
+
```
|
376
|
+
|
377
|
+
You can change the validation behaviour by overriding the `#validate!` method in your config class.
|
378
|
+
|
379
|
+
- Validate config attribute names. ([@palkan][])
|
380
|
+
|
381
|
+
Do not allow using reserved names (`Anyway::Config` method names).
|
382
|
+
Allow only alphanumeric names (matching `/^[a-z_]([\w]+)?$/`).
|
383
|
+
|
384
|
+
- Add Loaders API. ([@palkan][])
|
385
|
+
|
386
|
+
All config sources have standardized via _loaders_ API. It's possible to define
|
387
|
+
custom loaders or change the sources order.
|
388
|
+
|
389
|
+
## 2.0.0.pre2 (2019-04-26)
|
390
|
+
|
391
|
+
- Fix bug with loading from credentials when local credentials are missing. ([@palkan][])
|
392
|
+
|
393
|
+
## 2.0.0.pre (2019-04-26)
|
394
|
+
|
395
|
+
- **BREAKING** Changed the way of providing explicit values. ([@palkan][])
|
396
|
+
|
397
|
+
```ruby
|
398
|
+
# BEFORE
|
399
|
+
Config.new(overrides: data)
|
400
|
+
|
401
|
+
# AFTER
|
402
|
+
Config.new(data)
|
403
|
+
```
|
404
|
+
|
405
|
+
- Add Railtie. ([@palkan][])
|
406
|
+
|
407
|
+
`Anyway::Railtie` provides `Anyway::Settings` access via `Rails.applicaiton.configuration.anyway_config`.
|
408
|
+
|
409
|
+
It also adds `app/configs` path to autoload paths (low-level, `ActiveSupport::Dependencies`) to
|
410
|
+
make it possible to use configs in the app configuration files.
|
411
|
+
|
412
|
+
- Add test helpers. ([@palkan][])
|
413
|
+
|
414
|
+
Added `with_env` helper to test code in the context of the specified
|
415
|
+
environment variables.
|
416
|
+
|
417
|
+
Included automatically in RSpec for examples with the `type: :config` meta
|
418
|
+
or with the `spec/configs` path.
|
419
|
+
|
420
|
+
- Add support for _local_ files. ([@palkan][])
|
421
|
+
|
422
|
+
Now users can store their personal configurations in _local_ files:
|
423
|
+
|
424
|
+
- `<config_name>.local.yml`
|
425
|
+
- `config/credentials/local.yml.enc` (for Rails 6).
|
426
|
+
|
427
|
+
Local configs are meant for using in development and only loaded if
|
428
|
+
`Anyway::Settings.use_local_files` is `true` (which is true by default if
|
429
|
+
`RACK_ENV` or `RAILS_ENV` env variable is equal to `"development"`).
|
430
|
+
|
431
|
+
- Add Rails credentials support. ([@palkan][])
|
432
|
+
|
433
|
+
The data from credentials is loaded after the data from YAML config and secrets,
|
434
|
+
but before environmental variables (i.e. env variables are _stronger_)
|
435
|
+
|
436
|
+
- Update config name inference logic. ([@palkan][])
|
437
|
+
|
438
|
+
Config name is automatically inferred only if:
|
439
|
+
|
440
|
+
- the class name has a form of `<Module>::Config` (`SomeModule::Config => "some_module"`)
|
441
|
+
- the class name has a form of `<Something>Config` (`SomeConfig => "some"`)
|
442
|
+
|
443
|
+
- Fix config classes inheritance. ([@palkan][])
|
444
|
+
|
445
|
+
Previously, inheritance didn't work due to the lack of proper handling of class-level
|
446
|
+
configuration (naming, option parses settings, defaults).
|
447
|
+
|
448
|
+
Now it's possible to extend config classes without breaking the original classes functionality.
|
449
|
+
|
450
|
+
- **Require Ruby >= 2.5.0.**
|
451
|
+
|
452
|
+
## 1.4.3 (2019-02-04)
|
453
|
+
|
454
|
+
- Add a temporary fix for JRuby regression [#5550](https://github.com/jruby/jruby/issues/5550). ([@palkan][])
|
455
|
+
|
456
|
+
## 1.4.2 (2018-01-05)
|
457
|
+
|
458
|
+
- Fix: detect Rails by presence of `Rails::VERSION` (instead of just `Rails`). ([@palkan][])
|
459
|
+
|
460
|
+
## 1.4.1 (2018-10-30)
|
461
|
+
|
462
|
+
- Add `.flag_options` to mark some params as flags (value-less) for OptionParse. ([@palkan][])
|
463
|
+
|
464
|
+
## 1.4.0 (2018-10-29)
|
465
|
+
|
466
|
+
- Add OptionParse integration ([@jastkand][])
|
467
|
+
|
468
|
+
See more [PR#18](https://github.com/palkan/anyway_config/pull/18).
|
469
|
+
|
470
|
+
- Use underscored config name as an env prefix. ([@palkan][])
|
471
|
+
|
472
|
+
For a config class:
|
473
|
+
|
474
|
+
```ruby
|
475
|
+
class MyApp < Anyway::Config
|
476
|
+
end
|
477
|
+
```
|
478
|
+
|
479
|
+
Before this change we use `MYAPP_` prefix, now it's `MY_APP_`.
|
480
|
+
|
481
|
+
You can specify the prefix explicitly:
|
482
|
+
|
483
|
+
```ruby
|
484
|
+
class MyApp < Anyway::Config
|
485
|
+
env_prefix "MYAPP_"
|
486
|
+
end
|
487
|
+
```
|
488
|
+
|
489
|
+
## 1.3.0 (2018-06-15)
|
490
|
+
|
491
|
+
- Ruby 2.2 is no longer supported.
|
492
|
+
|
493
|
+
- `Anyway::Config.env_prefix` method is introduced. ([@charlie-wasp][])
|
494
|
+
|
495
|
+
## 1.2.0 (2018-02-19)
|
496
|
+
|
497
|
+
Now works on JRuby 9.1+.
|
498
|
+
|
499
|
+
## 1.1.3 (2017-12-20)
|
500
|
+
|
501
|
+
- Allow to pass raw hash with explicit values to `Config.new`. ([@dsalahutdinov][])
|
502
|
+
|
503
|
+
Example:
|
504
|
+
|
505
|
+
```ruby
|
506
|
+
Sniffer::Config.new(
|
507
|
+
overrides: {
|
508
|
+
enabled: true,
|
509
|
+
storage: {capacity: 500}
|
510
|
+
}
|
511
|
+
)
|
512
|
+
```
|
513
|
+
|
514
|
+
See more [PR#10](https://github.com/palkan/anyway_config/pull/10).
|
515
|
+
|
516
|
+
## 1.1.2 (2017-11-19)
|
517
|
+
|
518
|
+
- Enable aliases for YAML. ([@onemanstartup][])
|
519
|
+
|
520
|
+
## 1.1.1 (2017-10-21)
|
521
|
+
|
522
|
+
- Return deep duplicate of a Hash in `Env#fetch`. ([@palkan][])
|
523
|
+
|
524
|
+
## 1.1.0 (2017-10-06)
|
525
|
+
|
526
|
+
- Add `#to_h` method. ([@palkan][])
|
527
|
+
|
528
|
+
See [#4](https://github.com/palkan/anyway_config/issues/4).
|
529
|
+
|
530
|
+
- Make it possible to extend configuration parameters. ([@palkan][])
|
531
|
+
|
532
|
+
## 1.0.0 (2017-06-20)
|
533
|
+
|
534
|
+
- Lazy load and parse ENV configuration. ([@palkan][])
|
535
|
+
|
536
|
+
- Add support for ERB in YML configuration. ([@palkan][])
|
537
|
+
|
538
|
+
## 0.5.0 (2017-01-20)
|
539
|
+
|
540
|
+
- Drop `active_support` dependency. ([@palkan][])
|
541
|
+
|
542
|
+
Use custom refinements instead of requiring `active_support`.
|
543
|
+
|
544
|
+
No we're dependency-free!
|
545
|
+
|
546
|
+
## 0.1.0 (2015-01-20)
|
547
|
+
|
548
|
+
- Initial version.
|
549
|
+
|
550
|
+
[@palkan]: https://github.com/palkan
|
551
|
+
[@onemanstartup]: https://github.com/onemanstartup
|
552
|
+
[@dsalahutdinov]: https://github.com/dsalahutdinov
|
553
|
+
[@charlie-wasp]: https://github.com/charlie-wasp
|
554
|
+
[@jastkand]: https://github.com/jastkand
|
555
|
+
[@envek]: https://github.com/Envek
|
556
|
+
[@progapandist]: https://github.com/progapandist
|
557
|
+
[@skryukov]: https://github.com/skryukov
|
558
|
+
[@fargelus]: https://github.com/fargelus
|
559
|
+
[@prog-supdex]: https://github.com/prog-supdex
|
560
|
+
[@inner-whisper]: https://github.com/inner-whisper
|
561
|
+
[@tagirahmad]: https://github.com/tagirahmad
|
562
|
+
[@bessey]: https://github.com/bessey
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015-2020 Vladimir Dementyev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|