briefbag 1.0.3 → 1.0.4
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 +4 -0
- data/README.md +19 -3
- data/lib/briefbag/version.rb +1 -1
- data/lib/tasks/settings.rake +10 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bcd65204c8125e2a23ae6706f2697ac20110f48b8223e43ec9b5aa2265599f8
|
4
|
+
data.tar.gz: 645010474f211ab098bca35fa575fda18c5980d8797bcd7383d775d138064d58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c91bdf8252460cc67e44f35eb670d354a2c192aa05bbbdbcdaa809e7b6c942fdc232c83ffd58a35dfd7b4cc2732f074462c64dc3261a9873b343e8992bb0fb
|
7
|
+
data.tar.gz: c3af83908ffffc46c20b00468d69c5d36e871c8a4d1be4bfa7ba90a3876cc78408fe44d82e79a7165cff1fe54fd0db32606d0434c5f24fb93bf1f1523fd16fba
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -27,11 +27,9 @@ And what if you need to share the configuration file with colleagues, or use thi
|
|
27
27
|
Consul comes to the rescue. Thanks to him, you can act config and undress in different stands.
|
28
28
|
Generation `.yml` file there are 2 rake tasks: rake
|
29
29
|
|
30
|
-
|
31
|
-
- **rake settings:template2yml** - Generate basic `.yml` for your app. Based on it, you can fill it with any values
|
30
|
+
Need add to you Rakefile
|
32
31
|
|
33
32
|
|
34
|
-
Need add to you Rakefile
|
35
33
|
```ruby
|
36
34
|
|
37
35
|
require 'briefbag'
|
@@ -40,6 +38,24 @@ spec = Gem::Specification.find_by_name 'briefbag'
|
|
40
38
|
load "#{spec.gem_dir}/lib/tasks/settings.rake"
|
41
39
|
```
|
42
40
|
|
41
|
+
- **rake settings:consul2yml** - Get key/value variables from consul to `.yml` file
|
42
|
+
- **rake settings:transfer_config** - Transfer all collection configs in new consul folder
|
43
|
+
|
44
|
+
```shell
|
45
|
+
#rake settings:consul2yml[consul_host,consul_port,consul_token, my_project, environment,config_folder]
|
46
|
+
rake settings:consul2yml['127.0.0.1',8500,'consul_token','my_project','development',"config/configuration.yml"]
|
47
|
+
```
|
48
|
+
|
49
|
+
```shell
|
50
|
+
#rake settings:consul2yml[consul_host,consul_port,consul_token, my_project, from_path, to_path]
|
51
|
+
rake settings:transfer_config['127.0.0.1',8500,'consul_token','my_project','from','to']
|
52
|
+
```
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
43
59
|
#### Notifications:
|
44
60
|
If you use `.yml` .You will see:
|
45
61
|
> NOTICE! Your app using configs from yml file
|
data/lib/briefbag/version.rb
CHANGED
data/lib/tasks/settings.rake
CHANGED
@@ -31,13 +31,14 @@ namespace :settings do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
desc 'Transfer configs file in consul from/to projects'
|
34
|
-
task :transfer_config, [:
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
task :transfer_config, [:consul_host, :consul_port, :consul_token, :from, :to] do |_t, args|
|
35
|
+
url = URI::HTTP.build(host: args[:consul_host], port: args[:consul_port])
|
36
|
+
|
37
|
+
from = args[:from]
|
38
|
+
to = args[:to]
|
38
39
|
|
39
40
|
Diplomat.configure do |config|
|
40
|
-
config.url =
|
41
|
+
config.url = url
|
41
42
|
config.options = {
|
42
43
|
ssl: { version: :TLSv1_2 },
|
43
44
|
headers: {
|
@@ -45,20 +46,20 @@ namespace :settings do
|
|
45
46
|
}
|
46
47
|
}
|
47
48
|
end
|
48
|
-
|
49
|
+
|
50
|
+
keys = Diplomat::Kv.get(from.to_s, keys: true)
|
49
51
|
keys.delete_at(0) # delete self name folder
|
50
52
|
config_names = keys.map { |k| k.split('/').last }
|
51
53
|
|
52
54
|
config_names.each do |config_name|
|
53
55
|
warn Rainbow("Start read data for key: #{config_name}").yellow
|
54
|
-
config = Diplomat::Kv.get("#{from}/#{
|
55
|
-
Diplomat::Kv.put("#{to}/#{
|
56
|
+
config = Diplomat::Kv.get("#{from}/#{config_name}")
|
57
|
+
Diplomat::Kv.put("#{to}/#{config_name}", config)
|
56
58
|
warn Rainbow("Success transfer data for key: #{config_name}").green
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
62
|
desc 'create application.yml from template'
|
61
63
|
task template2yml: :environment do
|
62
|
-
p 'ya rake task'
|
63
64
|
end
|
64
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: briefbag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hitchens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diplomat
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
200
|
+
rubygems_version: 3.1.6
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Briefbag manage your config
|