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