qonfig 0.21.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +23 -20
- data/CHANGELOG.md +58 -2
- data/LICENSE.txt +1 -1
- data/README.md +124 -10
- data/Rakefile +0 -1
- data/bin/rspec +1 -0
- data/gemfiles/with_external_deps.gemfile +2 -0
- data/lib/qonfig.rb +4 -0
- data/lib/qonfig/commands/definition/expose_json.rb +2 -2
- data/lib/qonfig/commands/definition/expose_yaml.rb +2 -2
- data/lib/qonfig/commands/definition/load_from_json.rb +2 -2
- data/lib/qonfig/commands/definition/load_from_yaml.rb +2 -2
- data/lib/qonfig/commands/instantiation/values_file.rb +13 -4
- data/lib/qonfig/data_set.rb +13 -9
- data/lib/qonfig/dsl.rb +7 -7
- data/lib/qonfig/plugins.rb +1 -0
- data/lib/qonfig/plugins/pretty_print.rb +8 -1
- data/lib/qonfig/plugins/pretty_print/requirements.rb +3 -0
- data/lib/qonfig/plugins/pretty_print/ruby_2_7_basic_object_pp_patch.rb +44 -0
- data/lib/qonfig/plugins/toml/commands/definition/expose_toml.rb +4 -4
- data/lib/qonfig/plugins/toml/commands/definition/load_from_toml.rb +1 -1
- data/lib/qonfig/plugins/toml/data_set.rb +2 -2
- data/lib/qonfig/plugins/toml/dsl.rb +2 -2
- data/lib/qonfig/plugins/vault.rb +24 -0
- data/lib/qonfig/plugins/vault/commands/definition/expose_vault.rb +142 -0
- data/lib/qonfig/plugins/vault/commands/definition/load_from_vault.rb +53 -0
- data/lib/qonfig/plugins/vault/dsl.rb +35 -0
- data/lib/qonfig/plugins/vault/errors.rb +9 -0
- data/lib/qonfig/plugins/vault/loaders/vault.rb +73 -0
- data/lib/qonfig/settings.rb +78 -21
- data/lib/qonfig/settings/key_matcher.rb +2 -0
- data/lib/qonfig/uploaders/file.rb +2 -2
- data/lib/qonfig/uploaders/yaml.rb +1 -1
- data/lib/qonfig/version.rb +1 -1
- data/qonfig.gemspec +5 -6
- metadata +20 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b875f81a892a041c391457b18989daa2626ce3b04afb3e0290314a0fafeb8ad
|
4
|
+
data.tar.gz: f7eb3ff0d6801364070e22a8560fdfcc10e08bec59d8e876834b800682832394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0ea42e1bcaed282dee699f798eb8b21e188afb2f37720b9645c97dc9a791596604f65de2d81b34e83102a8f94a5a5fbb7892bd20184c0141884e3e4ac86a024
|
7
|
+
data.tar.gz: 6657ab2f25a10c86bda9c87cb32ccaa494fd831f1d237bd30f561f7c8e14da50e173de18ec2cca3a400d16769f8001397160b4ef33a9154da599d69317385ef9
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,30 +1,40 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
2
|
+
os: linux
|
3
|
+
dist: xenial
|
4
|
+
cache: bundler
|
5
|
+
before_install: gem install bundler
|
6
|
+
script: bundle exec rspec
|
7
|
+
jobs:
|
3
8
|
fast_finish: true
|
4
9
|
include:
|
5
|
-
- rvm: 2.4.
|
10
|
+
- rvm: 2.4.10
|
11
|
+
gemfile: gemfiles/with_external_deps.gemfile
|
12
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
13
|
+
- rvm: 2.5.8
|
6
14
|
gemfile: gemfiles/with_external_deps.gemfile
|
7
|
-
env: TEST_PLUGINS=true
|
8
|
-
- rvm: 2.
|
15
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
16
|
+
- rvm: 2.6.6
|
9
17
|
gemfile: gemfiles/with_external_deps.gemfile
|
10
|
-
env: TEST_PLUGINS=true
|
11
|
-
- rvm: 2.
|
18
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
19
|
+
- rvm: 2.7.1
|
12
20
|
gemfile: gemfiles/with_external_deps.gemfile
|
13
|
-
env: TEST_PLUGINS=true
|
21
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
14
22
|
- rvm: ruby-head
|
15
23
|
gemfile: gemfiles/with_external_deps.gemfile
|
16
|
-
env: TEST_PLUGINS=true
|
24
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
17
25
|
- rvm: jruby-head
|
18
26
|
gemfile: gemfiles/with_external_deps.gemfile
|
19
|
-
env: TEST_PLUGINS=true
|
27
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
20
28
|
- rvm: truffleruby
|
21
29
|
gemfile: gemfiles/with_external_deps.gemfile
|
22
|
-
env: TEST_PLUGINS=true
|
23
|
-
- rvm: 2.4.
|
30
|
+
env: TEST_PLUGINS=true FULL_TEST_COVERAGE_CHECK=true
|
31
|
+
- rvm: 2.4.10
|
24
32
|
gemfile: gemfiles/without_external_deps.gemfile
|
25
|
-
- rvm: 2.5.
|
33
|
+
- rvm: 2.5.8
|
26
34
|
gemfile: gemfiles/without_external_deps.gemfile
|
27
|
-
- rvm: 2.6.
|
35
|
+
- rvm: 2.6.6
|
36
|
+
gemfile: gemfiles/without_external_deps.gemfile
|
37
|
+
- rvm: 2.7.1
|
28
38
|
gemfile: gemfiles/without_external_deps.gemfile
|
29
39
|
- rvm: ruby-head
|
30
40
|
gemfile: gemfiles/without_external_deps.gemfile
|
@@ -36,10 +46,3 @@ matrix:
|
|
36
46
|
- rvm: ruby-head
|
37
47
|
- rvm: jruby-head
|
38
48
|
- rvm: truffleruby
|
39
|
-
sudo: false
|
40
|
-
cache: bundler
|
41
|
-
before_install: gem install bundler
|
42
|
-
script: bundle exec rspec
|
43
|
-
notifications:
|
44
|
-
slack:
|
45
|
-
secure: I03SDv+IrKy3IkeGjjHUJ9VneFMiYpLzIgPOixGFO5zGVXgulwmun82KsrPSW5HkK1UEQCahfoXt1hNECPwxcdsY01q6LBYJQx1jD0q17bXHllN/q0C6lx3peRN0KqNAAOU3/mHZxLt3HFV+N3HsSnoxDMuSYJgKbjCL/QVG2L2UYT9vi+JRNM/thj8R6MWKWlOHemik40GbLr2anCOCqiALzxnJzh5nJyGj+9SGvjhHfQq/fAIrg1+Scu+UchG8d+1yS5JWsGTt1/JF08i+Ux4ceTQ7GNBNeA5cj/xuUzvRx6A85renxyTiZMKIL0+jeceUm8c+/46XFcq0F7/kJB36lwjFhX1JRphcu/VouRdEwW/BvH74wnyHtygqOpk0LH4shp7A1DIS1DlnBbeJxrR5hdMDnmV85kTU6w6H0BbncsYY/pH1fji1kgH6jCsdwqDlq4wLB8x8I+eZABBsfb/r55z/HnBmmxlvR7Rt3X5/yR3gJrsgRrDBBZ5LwYy1RSCDu76vMQqWGJKG03FdfqSNqmC5V4MC5Ez8yjGDW0Yle09mwvsL2c6fDXyDPCeB/gwNk+FvgLRXnv7C4BaBNEoG4JnCL/dwauoJNg0lB6uF34BEmYAhZIrdY1CI6BqPWnaVMJfcJSYekBVXDIELDnTFRWjaGU1y8dM6lNzDmYE=
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,69 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [
|
4
|
+
## [0.25.0] - 2020-09-15
|
5
|
+
### Added
|
6
|
+
- Support for **Vault** config provider:
|
7
|
+
- realized as a plugin (`Qonfig.plugin(:vault)`);
|
8
|
+
- provides `#load_from_vault`, `#expose_vault` methods and works in `#*_yaml`-like manner);
|
9
|
+
- depends on `gem vault (>= 0.1)`
|
10
|
+
- `Qonfig::Settings#[]` behave like `Qonfig::Settings#__dig__`;
|
11
|
+
- An ability to represent the config hash in dot-notated style (all config keys are represented in dot-notated format):
|
12
|
+
- works via `#to_h(dot_style: true)`;
|
13
|
+
- `key_transformer:` and `value_transfomer:` options are supported too;
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
class Config << Qonfig::DataSet
|
17
|
+
setting :database do
|
18
|
+
setting :host, 'localhost'
|
19
|
+
setting :port, 6432
|
20
|
+
end
|
21
|
+
|
22
|
+
setting :api do
|
23
|
+
setting :rest_enabled, true
|
24
|
+
setting :rpc_enabled, false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Config.new.to_h(dot_style: true)
|
29
|
+
# =>
|
30
|
+
{
|
31
|
+
'database.host' => 'localhost',
|
32
|
+
'database.port' => 6432,
|
33
|
+
'api.rest_enabled' => true,
|
34
|
+
'api.rpc_enabled' => false,
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
## [0.24.1] - 2020-03-10
|
39
|
+
### Changed
|
40
|
+
- Enhanced dot-notated key resolving algorithm: now it goes through the all dot-notated key parts
|
41
|
+
until it finds the required setting key (or fails with `Qonfig::UnknowSettingKeyError`);
|
42
|
+
|
43
|
+
### Fixed
|
44
|
+
- (**Pretty-Print Plugin**):
|
45
|
+
- dot-noted setting keys can not be pretty-printed (they raise `Qonfig::UnknownSettingKeyError`);
|
46
|
+
- added `set` and `pp` as preloaded dependencies;
|
47
|
+
|
48
|
+
## [0.24.0] - 2019-12-29
|
49
|
+
### Added
|
50
|
+
- Support for **Ruby@2.7**;
|
51
|
+
|
52
|
+
## [0.23.0] - 2019-12-12
|
53
|
+
### Added
|
54
|
+
- Support for `Pathname` file path in `.load_from_json`, `.load_from_yaml`, `.load_from_toml`, `.expose_yaml`, `.expose_json`, `.expose_toml`;
|
55
|
+
|
56
|
+
## [0.22.0] - 2019-12-12
|
57
|
+
### Added
|
58
|
+
- Support for `Pathname` file path in `.values_file`, `#load_from_file`, `#load_from_yaml`, `#load_from_json` and `#load_from_toml`;
|
59
|
+
|
60
|
+
## [0.21.0] - 2019-12-12
|
5
61
|
### Added
|
6
62
|
- Brand new type of config objects `Qonfig::Compacted`:
|
7
63
|
- represents the compacted config object with setting readers and setting writers only;
|
8
64
|
- setting keys are represented as direct instace methods (`#settings` invokation does not need);
|
9
65
|
- no any other useful instance-based functionality;
|
10
|
-
- full support of `Qonfig::DataSet` DSL commands (
|
66
|
+
- full support of `Qonfig::DataSet` DSL commands (`.setting`, `.validate`, `.add_validator`, `.load_from_x`/`.expose_x` and etc);
|
11
67
|
- can be instantiated by:
|
12
68
|
- by existing config object: `Qonfig::DataSet#compacted` or `Qonfig::Compacted.build_from(config, &configuration)`
|
13
69
|
- by direct instantiation: `Qonfig::Compacted.new(settings_values = {}, &configuration)`;
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2018-
|
3
|
+
Copyright (c) 2018-2020 Rustam Ibragimov
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -40,6 +40,9 @@ require 'qonfig'
|
|
40
40
|
- [Inheritance](#inheritance)
|
41
41
|
- [Composition](#composition)
|
42
42
|
- [Hash representation](#hash-representation)
|
43
|
+
- [Default behaviour (without options)](#default-behavior-without-options)
|
44
|
+
- [With transformations](#with-transformations)
|
45
|
+
- [Dot-style format](#dot-style-format)
|
43
46
|
- [Smart Mixin](#smart-mixin) (`Qonfig::Configurable`)
|
44
47
|
- [Instantiation without class definition](#instantiation-without-class-definition) (`Qonfig::DataSet.build(&definitions)`)
|
45
48
|
- [Compacted config](#compacted-config)
|
@@ -90,7 +93,7 @@ require 'qonfig'
|
|
90
93
|
- [Load from \_\_END\_\_](#load-from-__end__) (aka `.load_from_self`)
|
91
94
|
- [Expose \_\_END\_\_](#expose-__end__) (aka `.expose_self`)
|
92
95
|
- **Setting values**
|
93
|
-
- `(instance methods for loading setting values from a file to existing config object with already defined setting keys)`
|
96
|
+
- `(instance methods for loading the setting values from a file to existing config object with already defined setting keys)`
|
94
97
|
- [Default setting values file](#default-setting-values-file)
|
95
98
|
- [Load setting values from YAML file](#load-setting-values-from-yaml-file-by-instance)
|
96
99
|
- [Load setting values from JSON file](#load-setting-values-from-json-file-by-instance)
|
@@ -102,7 +105,9 @@ require 'qonfig'
|
|
102
105
|
- [Plugins](#plugins)
|
103
106
|
- [toml](#plugins-toml) (support for `TOML` format)
|
104
107
|
- [pretty_print](#plugins-pretty_print) (beautified/prettified console output)
|
108
|
+
- [vault](#plugins-vault) (support for `Vault` store)
|
105
109
|
- [Roadmap](#roadmap)
|
110
|
+
- [Build](#build)
|
106
111
|
---
|
107
112
|
|
108
113
|
## Definition
|
@@ -187,6 +192,10 @@ config.settings['vendor_api']['domain'] # => 'app.service.com'
|
|
187
192
|
config.settings['vendor_api']['login'] # => 'test_user'
|
188
193
|
config.settings['enable_graphql'] # => false
|
189
194
|
|
195
|
+
# dig to value
|
196
|
+
config.settings[:vendor_api, :domain] # => 'app.service.com'
|
197
|
+
config.settings[:vendor_api, 'login'] # => 'test_user'
|
198
|
+
|
190
199
|
# get option value directly via index (with indifferent access)
|
191
200
|
config['project_id'] # => nil
|
192
201
|
config['enable_graphql'] # => false
|
@@ -270,7 +279,7 @@ config.slice_value('vendor_api.port') # => Qonfig::UnknownSettingError # (key do
|
|
270
279
|
# - get a subset (a set of sets) of config settings represented as a hash;
|
271
280
|
# - each key (or key set) represents a requirement of a certain setting key;
|
272
281
|
|
273
|
-
config.
|
282
|
+
config.subset(:vendor_api, :enable_graphql)
|
274
283
|
# => { 'vendor_api' => { 'login' => ..., 'domain' => ... }, 'enable_graphql' => false }
|
275
284
|
|
276
285
|
config.subset(:project_id, [:vendor_api, :domain], [:credentials, :user, :login])
|
@@ -435,6 +444,12 @@ project_config.settings.db.password # => 'testpaswd'
|
|
435
444
|
|
436
445
|
### Hash representation
|
437
446
|
|
447
|
+
- works via `#to_h` and `#to_hash`;
|
448
|
+
- supported options:
|
449
|
+
- `key_transformer:` - an optional proc that accepts setting key and makes your custom transformations;
|
450
|
+
- `value_transformer:` - an optional proc that accepts setting value and makes your custom transformations;
|
451
|
+
- `dot_style:` - (`false` by default) represent setting keys in dot-notation (transformations are supported too);
|
452
|
+
|
438
453
|
```ruby
|
439
454
|
class Config < Qonfig::DataSet
|
440
455
|
setting :serializers do
|
@@ -453,9 +468,13 @@ class Config < Qonfig::DataSet
|
|
453
468
|
|
454
469
|
setting :logger, Logger.new(STDOUT)
|
455
470
|
end
|
471
|
+
```
|
456
472
|
|
457
|
-
|
473
|
+
#### Default behavior (without-options)
|
458
474
|
|
475
|
+
```ruby
|
476
|
+
Config.new.to_h
|
477
|
+
# =>
|
459
478
|
{
|
460
479
|
"serializers": {
|
461
480
|
"json" => { "engine" => :ok },
|
@@ -466,6 +485,55 @@ Config.new.to_h
|
|
466
485
|
}
|
467
486
|
```
|
468
487
|
|
488
|
+
#### With transformations
|
489
|
+
|
490
|
+
- with `key_transformer` and/or `value_transformer`;
|
491
|
+
|
492
|
+
```ruby
|
493
|
+
key_transformer = -> (key) { "#{key}!!" }
|
494
|
+
value_transformer = -> (value) { "#{value}??" }
|
495
|
+
|
496
|
+
Config.new.to_h(key_transformer: key_transformer, value_transformer: value_transformer)
|
497
|
+
# =>
|
498
|
+
{
|
499
|
+
"serializers!!": {
|
500
|
+
"json!!" => { "engine!!" => "ok??" },
|
501
|
+
"hash!!" => { "engine!!" => "native??" },
|
502
|
+
},
|
503
|
+
"adapter!!" => { "default!!" => "memory_sync??" },
|
504
|
+
"logger!!" => "#<Logger:0x00007fcde799f158>??"
|
505
|
+
}
|
506
|
+
```
|
507
|
+
|
508
|
+
#### Dot-style format
|
509
|
+
|
510
|
+
- transformations are supported too (`key_transformer` and `value_transformer`);
|
511
|
+
|
512
|
+
```ruby
|
513
|
+
Config.new.to_h(dot_style: true)
|
514
|
+
# =>
|
515
|
+
{
|
516
|
+
"serializers.json.engine" => :ok,
|
517
|
+
"serializers.hash.engine" => :native,
|
518
|
+
"adapter.default" => :memory_sync,
|
519
|
+
"logger" => #<Logger:0x4b0d79fc>,
|
520
|
+
}
|
521
|
+
```
|
522
|
+
|
523
|
+
```ruby
|
524
|
+
transformer = -> (value) { "$$#{value}$$" }
|
525
|
+
|
526
|
+
Config.new.to_h(dot_style: true, key_transformer: transformer, value_transformer: transformer)
|
527
|
+
|
528
|
+
# => "#<Logger:0x00007fcde799f158>??"
|
529
|
+
{
|
530
|
+
"$$serializers.json.engine$$" => "$$ok$$",
|
531
|
+
"$$serializers.hash.engine$$" => "$$native$$",
|
532
|
+
"$$adapter.default$$" => "$$memory_sync$$",
|
533
|
+
"$$logger$$" => "$$#<Logger:0x00007fcde799f158>$$",
|
534
|
+
}
|
535
|
+
```
|
536
|
+
|
469
537
|
---
|
470
538
|
|
471
539
|
### Smart Mixin
|
@@ -633,9 +701,8 @@ config.settings.web_api # => "api.google.com"
|
|
633
701
|
|
634
702
|
---
|
635
703
|
|
636
|
-
- `Qonfig::Compacted`: represents the compacted config object with setting readers and setting
|
704
|
+
- `Qonfig::Compacted`: represents the compacted config object with setting readers, setting writers and setting predicates only - and no any other useful instance-based functionality:
|
637
705
|
- setting keys are represented as direct instace methods (`#settings` invokation does not need);
|
638
|
-
- no any other useful instance-based functionality - just setting readers, setting writers and setting predicates:
|
639
706
|
- support for index-like access methods (`[]`,`[]=`);
|
640
707
|
- full support of `Qonfig::DataSet` definition DSL commands:
|
641
708
|
- `setting`, `re_setting` [doc](#definition-and-access)
|
@@ -646,9 +713,9 @@ config.settings.web_api # => "api.google.com"
|
|
646
713
|
- support for validation of potential setting values `.valid_with?` [documentation](#validation-of-potential-setting-values);
|
647
714
|
- can be instantiated by:
|
648
715
|
- by existing config object: `Qonfig::DataSet#compacted` or `Qonfig::Compacted.build_from(config, &configuration)`;
|
649
|
-
- from existing `Qonfig::DataSet` class:
|
716
|
+
- from existing `Qonfig::DataSet` class: `Qonfig::DataSet.build_compacted`;
|
650
717
|
- by direct instantiation: `Qonfig::Compacted.new(settings_values = {}, &configuration)`;
|
651
|
-
- by implicit instance building without explicit class definition `Qonfig::Compacted.build(&dsl_commands)
|
718
|
+
- by implicit instance building without explicit class definition `Qonfig::Compacted.build(&dsl_commands)`;
|
652
719
|
- you can define your own instance methods too;
|
653
720
|
|
654
721
|
---
|
@@ -1001,6 +1068,8 @@ config.root_keys
|
|
1001
1068
|
- method signature: `#reload!(configurations = {}, &configuration)`;
|
1002
1069
|
|
1003
1070
|
```ruby
|
1071
|
+
# -- config example ---
|
1072
|
+
|
1004
1073
|
class Config < Qonfig::DataSet
|
1005
1074
|
setting :db do
|
1006
1075
|
setting :adapter, 'postgresql'
|
@@ -1013,6 +1082,10 @@ config = Config.new
|
|
1013
1082
|
|
1014
1083
|
config.settings.db.adapter # => 'postgresql'
|
1015
1084
|
config.settings.logger # => #<Logger:0x00007ff9>
|
1085
|
+
```
|
1086
|
+
|
1087
|
+
```ruby
|
1088
|
+
# --- redefine some settings (or add a new one) --
|
1016
1089
|
|
1017
1090
|
config.configure { |conf| conf.logger = nil } # redefine some settings (will be reloaded)
|
1018
1091
|
|
@@ -1024,6 +1097,10 @@ class Config
|
|
1024
1097
|
|
1025
1098
|
setting :enable_api, false # append new setting
|
1026
1099
|
end
|
1100
|
+
```
|
1101
|
+
|
1102
|
+
```ruby
|
1103
|
+
# --- reload ---
|
1027
1104
|
|
1028
1105
|
# reload settings
|
1029
1106
|
config.reload!
|
@@ -3081,6 +3158,7 @@ dynamic: 10
|
|
3081
3158
|
|
3082
3159
|
- [toml](#plugins-toml) (provides `load_from_toml`, `save_to_toml`, `expose_toml`);
|
3083
3160
|
- [pretty_print](#plugins-pretty_print) (beautified/prettified console output);
|
3161
|
+
- [vault](#plugins-vault) (provides `load_from_vault`, `expose_vault`)
|
3084
3162
|
|
3085
3163
|
---
|
3086
3164
|
|
@@ -3204,15 +3282,51 @@ config = Config.new
|
|
3204
3282
|
|
3205
3283
|
---
|
3206
3284
|
|
3285
|
+
### Plugins: vault
|
3286
|
+
|
3287
|
+
- `Qonfig.plugin(:vault)`
|
3288
|
+
- adds support for `vault kv store`, [more info](https://www.vaultproject.io/docs/secrets/kv/kv-v2)
|
3289
|
+
- depends on `vault` gem ([link](https://github.com/hashicorp/vault-ruby)) (tested on `>= 0.1`);
|
3290
|
+
- provides `.load_from_vault` (works in `.load_from_yaml` manner ([doc](#load-from-yaml-file)));
|
3291
|
+
- provides `.expose_vault` (works in `.expose_yaml` manner ([doc](#expose-yaml)));
|
3292
|
+
|
3293
|
+
```ruby
|
3294
|
+
# 1) require external dependency
|
3295
|
+
require 'vault'
|
3296
|
+
|
3297
|
+
# 2) Setup vault client
|
3298
|
+
|
3299
|
+
Vault.address = 'http://localhost:8200'
|
3300
|
+
Vault.token = 'super-duper-token-here'
|
3301
|
+
|
3302
|
+
# 3) enable plugin
|
3303
|
+
Qonfig.plugin(:vault)
|
3304
|
+
|
3305
|
+
# 3) use vault :)
|
3306
|
+
```
|
3307
|
+
|
3308
|
+
---
|
3309
|
+
|
3207
3310
|
## Roadmap
|
3208
3311
|
|
3209
3312
|
- **Major**:
|
3210
|
-
- distributed configuration server;
|
3211
|
-
- cli toolchain;
|
3212
3313
|
- support for Rails-like secrets;
|
3213
3314
|
- support for persistent data storages (we want to store configs in multiple databases and files);
|
3214
|
-
-
|
3315
|
+
- rails plugin;
|
3316
|
+
- support for pattern matching;
|
3215
3317
|
- **Minor**:
|
3318
|
+
- An ability to flag `Qonfig::Configurable`'s config object as `compacted` (`Qonfig::Compacted`);
|
3319
|
+
- Instance-based behavior for `Vault` plugin, also use instance of `Vault` client instead of `Singleton`;
|
3320
|
+
- External validation class with an importing api for better custom validations;
|
3321
|
+
- Setting value changement trace (in `anyway_config` manner);
|
3322
|
+
- Instantiation and reloading callbacks;
|
3323
|
+
|
3324
|
+
## Build
|
3325
|
+
|
3326
|
+
```shell
|
3327
|
+
bin/rspec -w # test the core functionality and plugins
|
3328
|
+
bin/rspec -n # test only the core functionality
|
3329
|
+
```
|
3216
3330
|
|
3217
3331
|
## Contributing
|
3218
3332
|
|
data/Rakefile
CHANGED
data/bin/rspec
CHANGED
data/lib/qonfig.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'set'
|
3
4
|
require 'yaml'
|
4
5
|
require 'json'
|
5
6
|
require 'erb'
|
7
|
+
require 'pathname'
|
6
8
|
|
7
9
|
# @api public
|
8
10
|
# @since 0.1.0
|
@@ -62,4 +64,6 @@ module Qonfig
|
|
62
64
|
register_plugin('toml', Qonfig::Plugins::TOML)
|
63
65
|
# @since 0.19.0
|
64
66
|
register_plugin('pretty_print', Qonfig::Plugins::PrettyPrint)
|
67
|
+
# @since 0.25.0
|
68
|
+
register_plugin('vault', Qonfig::Plugins::Vault)
|
65
69
|
end
|