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