runger_config 3.0.0 → 4.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/CHANGELOG.md +45 -36
- data/README.md +83 -83
- data/lib/generators/{anyway → runger}/app_config/app_config_generator.rb +2 -2
- data/lib/generators/{anyway → runger}/config/config_generator.rb +3 -8
- data/lib/generators/{anyway → runger}/config/templates/config.rb.tt +0 -3
- data/lib/generators/{anyway → runger}/install/install_generator.rb +4 -4
- data/lib/generators/{anyway → runger}/install/templates/application_config.rb.tt +1 -1
- data/lib/{anyway → runger}/auto_cast.rb +1 -1
- data/lib/{anyway → runger}/config.rb +22 -22
- data/lib/{anyway → runger}/dynamic_config.rb +2 -2
- data/lib/{anyway → runger}/ejson_parser.rb +3 -3
- data/lib/{anyway → runger}/env.rb +3 -3
- data/lib/{anyway → runger}/ext/deep_dup.rb +1 -1
- data/lib/{anyway → runger}/ext/deep_freeze.rb +1 -1
- data/lib/{anyway → runger}/ext/flatten_names.rb +1 -1
- data/lib/{anyway → runger}/ext/hash.rb +1 -1
- data/lib/{anyway → runger}/ext/string_constantize.rb +1 -1
- data/lib/{anyway → runger}/loaders/base.rb +2 -2
- data/lib/{anyway → runger}/loaders/doppler.rb +2 -2
- data/lib/{anyway → runger}/loaders/ejson.rb +3 -3
- data/lib/{anyway → runger}/loaders/env.rb +2 -2
- data/lib/{anyway → runger}/loaders/yaml.rb +3 -3
- data/lib/{anyway → runger}/loaders.rb +6 -6
- data/lib/{anyway → runger}/option_parser_builder.rb +1 -1
- data/lib/{anyway → runger}/optparse_config.rb +6 -6
- data/lib/{anyway → runger}/rails/autoload.rb +5 -5
- data/lib/{anyway → runger}/rails/config.rb +3 -3
- data/lib/{anyway → runger}/rails/loaders/credentials.rb +2 -2
- data/lib/{anyway → runger}/rails/loaders/secrets.rb +3 -3
- data/lib/{anyway → runger}/rails/loaders/yaml.rb +2 -2
- data/lib/runger/rails/loaders.rb +5 -0
- data/lib/{anyway → runger}/rails/settings.rb +2 -2
- data/lib/runger/rails.rb +24 -0
- data/lib/{anyway → runger}/railtie.rb +7 -7
- data/lib/{anyway → runger}/rbs.rb +1 -1
- data/lib/{anyway → runger}/settings.rb +4 -4
- data/lib/{anyway → runger}/testing/helpers.rb +4 -4
- data/lib/{anyway → runger}/testing.rb +2 -2
- data/lib/{anyway → runger}/tracing.rb +4 -4
- data/lib/{anyway → runger}/type_casting.rb +4 -4
- data/lib/{anyway → runger}/utils/deep_merge.rb +2 -2
- data/lib/{anyway → runger}/utils/which.rb +1 -1
- data/lib/runger/version.rb +5 -0
- data/lib/{anyway.rb → runger.rb} +1 -1
- data/lib/runger_config.rb +49 -0
- data/sig/{anyway_config.rbs → runger_config.rbs} +1 -1
- metadata +51 -51
- data/lib/anyway/rails/loaders.rb +0 -5
- data/lib/anyway/rails.rb +0 -24
- data/lib/anyway/version.rb +0 -5
- data/lib/anyway_config.rb +0 -49
- /data/lib/generators/{anyway → runger}/app_config/USAGE +0 -0
- /data/lib/generators/{anyway → runger}/config/USAGE +0 -0
- /data/lib/generators/{anyway → runger}/config/templates/config.yml.tt +0 -0
- /data/lib/generators/{anyway → runger}/install/USAGE +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b64cf53f84cf85e579523fa523e04afdd2c32dd75b219cf5a700df552368ded
|
4
|
+
data.tar.gz: 59459b83f4aff3789c5289a1ed5c33b686dd5012a73eff0ae4627e5eb2e3a3a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7b719cb241b1e1d5c4d7d12d1563179e38e68f7aa777142c4ae8d497d13542f1a07c3b17f9ac7c6c9b9117a5b2bb20cbaab5a8b46a07bbab239cda1f3b5703e
|
7
|
+
data.tar.gz: 6f2156c5baecc455d4747a70351844c5161e9bb266743ed372dcde9634b6a6054524c354f85629863094e56b9311aa1e706b914ac405412008bb2980ac645bc8
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
|
1
|
+
## v4.0.0 (2023-11-19)
|
2
|
+
|
3
|
+
- [BREAKING] Rename from Anyway Config to Runger Config
|
4
|
+
- You will now need to `require 'runger_config'`, rather than `require 'anyway_config'`
|
5
|
+
|
6
|
+
## v3.0.1 (2023-11-19)
|
7
|
+
|
8
|
+
- Fix specs broken by 3.0 release
|
9
|
+
|
10
|
+
- Suppress linting errors in docs
|
2
11
|
|
3
12
|
## v3.0.0 (2023-11-19)
|
4
13
|
|
@@ -34,19 +43,19 @@
|
|
34
43
|
|
35
44
|
- Fix Rails detection. ([@palkan][])
|
36
45
|
|
37
|
-
Fixes [#134](https://github.com/palkan/
|
46
|
+
Fixes [#134](https://github.com/palkan/runger_config/issues/134).
|
38
47
|
|
39
48
|
## 2.5.0 (2023-07-24)
|
40
49
|
|
41
50
|
- Generators: Add `config_name` to generated classes if name contains underscore. ([@palkan][])
|
42
51
|
|
43
|
-
- Load Rails extensions even if Rails was loaded after
|
52
|
+
- Load Rails extensions even if Rails was loaded after Runger Config. ([@palkan][])
|
44
53
|
|
45
54
|
- Fix handling `config.credentials.content_path` provided as String. ([@palkan][])
|
46
55
|
|
47
56
|
## 2.4.2 (2023-06-07)
|
48
57
|
|
49
|
-
- Use
|
58
|
+
- Use RUNGER_ENV as the current environment if defined. ([@palkan][])
|
50
59
|
|
51
60
|
It can be used to specify environment for configs independently of Rails environment.
|
52
61
|
|
@@ -63,11 +72,11 @@ It can be used to specify environment for configs independently of Rails environ
|
|
63
72
|
- Added experimental support for sub-configs via coercion. ([@palkan][])
|
64
73
|
|
65
74
|
```ruby
|
66
|
-
class AnotherConfig <
|
75
|
+
class AnotherConfig < Runger::Config
|
67
76
|
attr_config foo: "bar"
|
68
77
|
end
|
69
78
|
|
70
|
-
class MyConfig <
|
79
|
+
class MyConfig < Runger::Config
|
71
80
|
attr_config :another_config
|
72
81
|
|
73
82
|
coerce_types another_config: "AnotherConfig"
|
@@ -86,7 +95,7 @@ MyConfig.new.another_config.foo #=> "baz"
|
|
86
95
|
The API is inspired by Rails permitted params:
|
87
96
|
|
88
97
|
```ruby
|
89
|
-
class AppConfig <
|
98
|
+
class AppConfig < Runger::Config
|
90
99
|
attr_config :assets_host, database: {host: nil, port: nil}
|
91
100
|
|
92
101
|
required :assets_host, database: [:host, :port]
|
@@ -95,7 +104,7 @@ end
|
|
95
104
|
|
96
105
|
- Add support for using `env_prefix ""` to load from unprefixed env vars. ([@palkan][])
|
97
106
|
|
98
|
-
See [#118](https://github.com/palkan/
|
107
|
+
See [#118](https://github.com/palkan/runger_config/issues/118).
|
99
108
|
|
100
109
|
- Added EJSON support. ([@inner-whisper])
|
101
110
|
|
@@ -103,7 +112,7 @@ See [#118](https://github.com/palkan/anyway_config/issues/118).
|
|
103
112
|
|
104
113
|
## 2.3.1 (2023-01-17)
|
105
114
|
|
106
|
-
- [Fixes [#110](https://github.com/palkan/
|
115
|
+
- [Fixes [#110](https://github.com/palkan/runger_config/issues/110)] Fix setting up autoloader for the same folder. ([@palkan][])
|
107
116
|
|
108
117
|
- RBS: Now `.on_load` automatically pass block context type (instance), so no need to add annotations! ([@palkan][])
|
109
118
|
|
@@ -115,10 +124,10 @@ Steep 1.2+ is required. Read more about the [feature](https://hackmd.io/xLrYaqUt
|
|
115
124
|
|
116
125
|
- Add ability to load configurations under specific environments in pure Ruby apps. ([@fargelus][]).
|
117
126
|
|
118
|
-
Before loading environment configurations you need to specify variable `
|
127
|
+
Before loading environment configurations you need to specify variable `Runger::Settings.current_environment`. In Rails apps this variable is same as `Rails.env` value.
|
119
128
|
After adding yaml loader will try to load params under this environment.
|
120
129
|
|
121
|
-
Also required env option was added to `
|
130
|
+
Also required env option was added to `Runger::Config`.
|
122
131
|
|
123
132
|
## 2.2.3 (2022-01-21)
|
124
133
|
|
@@ -126,8 +135,8 @@ Also required env option was added to `Anyway::Config`.
|
|
126
135
|
|
127
136
|
- Add ability to set default key for environmental YAML files. ([@skryukov])
|
128
137
|
|
129
|
-
Define a key for environmental yaml files to read default values from with `config.
|
130
|
-
This way
|
138
|
+
Define a key for environmental yaml files to read default values from with `config.runger_config.default_environmental_key = "default"`.
|
139
|
+
This way Runger Config will try to read settings under the `"default"` key and then merge environmental settings into them.
|
131
140
|
|
132
141
|
## 2.2.2 (2020-10-26)
|
133
142
|
|
@@ -141,7 +150,7 @@ This way Anyway Config will try to read settings under the `"default"` key and t
|
|
141
150
|
|
142
151
|
- Add RBS signatures and generator. ([@palkan][])
|
143
152
|
|
144
|
-
|
153
|
+
Runger Config now ships with the basic RBS support. To use config types with Steep, add `library "runger_config"` to your Steepfile.
|
145
154
|
|
146
155
|
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.
|
147
156
|
|
@@ -150,7 +159,7 @@ We also provide an API to generate a signature for you config class: `MyConfig.t
|
|
150
159
|
Example:
|
151
160
|
|
152
161
|
```ruby
|
153
|
-
class CoolConfig <
|
162
|
+
class CoolConfig < Runger::Config
|
154
163
|
attr_config :port, :user
|
155
164
|
|
156
165
|
coerce_types port: :string, user: {dob: :date}
|
@@ -177,28 +186,28 @@ You can also add `.disable_auto_cast!` to your config class to disable automatic
|
|
177
186
|
|
178
187
|
Config setters no longer write instance variables.
|
179
188
|
|
180
|
-
- Add `config.
|
189
|
+
- Add `config.runger_config.future` to allow enabling upcoming features. ([@palkan][])
|
181
190
|
|
182
191
|
For smoother upgrades, we provide a mechanism to opt-out to the new defaults beforehand.
|
183
192
|
Currently, only `:unwrap_known_environments` feature could be enabled (see below):
|
184
193
|
|
185
194
|
```ruby
|
186
|
-
config.
|
195
|
+
config.runger_config.future.use :unwrap_known_environments
|
187
196
|
```
|
188
197
|
|
189
198
|
- 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)
|
190
199
|
|
191
|
-
- Add the `known_environments` property to
|
200
|
+
- Add the `known_environments` property to Runger::Settings under Rails. Use `config.runger_config.known_environments << "staging"` to make the gem aware of custom environments. ([@progapandist][])
|
192
201
|
|
193
202
|
- Make it possible to specify default YML configs directory. ([@palkan][])
|
194
203
|
|
195
204
|
For example:
|
196
205
|
|
197
206
|
```ruby
|
198
|
-
|
207
|
+
Runger::Settings.default_config_path = "path/to/configs"
|
199
208
|
|
200
209
|
# or in Rails
|
201
|
-
config.
|
210
|
+
config.runger_config.default_config_path = Rails.root.join("my/configs")
|
202
211
|
```
|
203
212
|
|
204
213
|
## 2.0.6 (2020-07-7)
|
@@ -221,13 +230,13 @@ config.anyway_config.default_config_path = Rails.root.join("my/configs")
|
|
221
230
|
|
222
231
|
- Make sure configs are eager loaded in Rails when `config.eager_load = true`. ([@palkan][])
|
223
232
|
|
224
|
-
Fixes [#58](https://github.com/palkan/
|
233
|
+
Fixes [#58](https://github.com/palkan/runger_config/issues/58).
|
225
234
|
|
226
235
|
## 2.0.1 (2020-04-15)
|
227
236
|
|
228
237
|
- Fix loading Railtie when application has been already initialized. ([@palkan][])
|
229
238
|
|
230
|
-
Fixes [#56](https://github.com/palkan/
|
239
|
+
Fixes [#56](https://github.com/palkan/runger_config/issues/56).
|
231
240
|
|
232
241
|
## 2.0.0 (2020-04-14)
|
233
242
|
|
@@ -240,7 +249,7 @@ Fixes [#56](https://github.com/palkan/anyway_config/issues/56).
|
|
240
249
|
For example:
|
241
250
|
|
242
251
|
```ruby
|
243
|
-
class MyConfig <
|
252
|
+
class MyConfig < Runger::Config
|
244
253
|
attr_config :key, :secret, debug: false
|
245
254
|
end
|
246
255
|
|
@@ -313,13 +322,13 @@ _dynamic_ (runtime) configs.
|
|
313
322
|
you can set static configs path to `app/configs`:
|
314
323
|
|
315
324
|
```ruby
|
316
|
-
config.
|
325
|
+
config.runger_config.autoload_static_config_path = "app/configs"
|
317
326
|
```
|
318
327
|
|
319
328
|
You can do this by running the generator:
|
320
329
|
|
321
330
|
```sh
|
322
|
-
rails g
|
331
|
+
rails g runger:install --configs-path=app/configs
|
323
332
|
```
|
324
333
|
|
325
334
|
- Add Rails generators. ([@palkan][])
|
@@ -377,20 +386,20 @@ You can specify some params as required, and the validation
|
|
377
386
|
error would be raised if they're missing or empty (only for strings):
|
378
387
|
|
379
388
|
```ruby
|
380
|
-
class MyConfig <
|
389
|
+
class MyConfig < Runger::Config
|
381
390
|
attr_config :api_key, :api_secret, :debug
|
382
391
|
|
383
392
|
required :api_key, :api_secret
|
384
393
|
end
|
385
394
|
|
386
|
-
MyConfig.new(api_secret: "") #=> raises
|
395
|
+
MyConfig.new(api_secret: "") #=> raises Runger::Config::ValidationError
|
387
396
|
```
|
388
397
|
|
389
398
|
You can change the validation behaviour by overriding the `#validate!` method in your config class.
|
390
399
|
|
391
400
|
- Validate config attribute names. ([@palkan][])
|
392
401
|
|
393
|
-
Do not allow using reserved names (`
|
402
|
+
Do not allow using reserved names (`Runger::Config` method names).
|
394
403
|
Allow only alphanumeric names (matching `/^[a-z_]([\w]+)?$/`).
|
395
404
|
|
396
405
|
- Add Loaders API. ([@palkan][])
|
@@ -416,7 +425,7 @@ Config.new(data)
|
|
416
425
|
|
417
426
|
- Add Railtie. ([@palkan][])
|
418
427
|
|
419
|
-
`
|
428
|
+
`Runger::Railtie` provides `Runger::Settings` access via `Rails.applicaiton.configuration.runger_config`.
|
420
429
|
|
421
430
|
It also adds `app/configs` path to autoload paths (low-level, `ActiveSupport::Dependencies`) to
|
422
431
|
make it possible to use configs in the app configuration files.
|
@@ -437,7 +446,7 @@ Now users can store their personal configurations in _local_ files:
|
|
437
446
|
- `config/credentials/local.yml.enc` (for Rails 6).
|
438
447
|
|
439
448
|
Local configs are meant for using in development and only loaded if
|
440
|
-
`
|
449
|
+
`Runger::Settings.use_local_files` is `true` (which is true by default if
|
441
450
|
`RACK_ENV` or `RAILS_ENV` env variable is equal to `"development"`).
|
442
451
|
|
443
452
|
- Add Rails credentials support. ([@palkan][])
|
@@ -477,14 +486,14 @@ Now it's possible to extend config classes without breaking the original classes
|
|
477
486
|
|
478
487
|
- Add OptionParse integration ([@jastkand][])
|
479
488
|
|
480
|
-
See more [PR#18](https://github.com/palkan/
|
489
|
+
See more [PR#18](https://github.com/palkan/runger_config/pull/18).
|
481
490
|
|
482
491
|
- Use underscored config name as an env prefix. ([@palkan][])
|
483
492
|
|
484
493
|
For a config class:
|
485
494
|
|
486
495
|
```ruby
|
487
|
-
class MyApp <
|
496
|
+
class MyApp < Runger::Config
|
488
497
|
end
|
489
498
|
```
|
490
499
|
|
@@ -493,7 +502,7 @@ Before this change we use `MYAPP_` prefix, now it's `MY_APP_`.
|
|
493
502
|
You can specify the prefix explicitly:
|
494
503
|
|
495
504
|
```ruby
|
496
|
-
class MyApp <
|
505
|
+
class MyApp < Runger::Config
|
497
506
|
env_prefix "MYAPP_"
|
498
507
|
end
|
499
508
|
```
|
@@ -502,7 +511,7 @@ end
|
|
502
511
|
|
503
512
|
- Ruby 2.2 is no longer supported.
|
504
513
|
|
505
|
-
- `
|
514
|
+
- `Runger::Config.env_prefix` method is introduced. ([@charlie-wasp][])
|
506
515
|
|
507
516
|
## 1.2.0 (2018-02-19)
|
508
517
|
|
@@ -523,7 +532,7 @@ Sniffer::Config.new(
|
|
523
532
|
)
|
524
533
|
```
|
525
534
|
|
526
|
-
See more [PR#10](https://github.com/palkan/
|
535
|
+
See more [PR#10](https://github.com/palkan/runger_config/pull/10).
|
527
536
|
|
528
537
|
## 1.1.2 (2017-11-19)
|
529
538
|
|
@@ -537,7 +546,7 @@ See more [PR#10](https://github.com/palkan/anyway_config/pull/10).
|
|
537
546
|
|
538
547
|
- Add `#to_h` method. ([@palkan][])
|
539
548
|
|
540
|
-
See [#4](https://github.com/palkan/
|
549
|
+
See [#4](https://github.com/palkan/runger_config/issues/4).
|
541
550
|
|
542
551
|
- Make it possible to extend configuration parameters. ([@palkan][])
|
543
552
|
|