briefbag 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 847b2eac70d86e0e7a441558a5e349d6ed62080e2ac3e7f001ecb8bbd94f909b
4
- data.tar.gz: 8440f522254017d03af9f9d55ec8d8e77aba5cc0161168e66bf61a9926750cb7
3
+ metadata.gz: 1bcd65204c8125e2a23ae6706f2697ac20110f48b8223e43ec9b5aa2265599f8
4
+ data.tar.gz: 645010474f211ab098bca35fa575fda18c5980d8797bcd7383d775d138064d58
5
5
  SHA512:
6
- metadata.gz: dabd99f5bbdbf3ac15c7f35de444a7ecff8538a17d9b178768f32f41e356b4c39b65b273854b8b5e4c61981ad91fa1ca2ca66b749eeaef1cf322f7bb9b4869cc
7
- data.tar.gz: ec38c8fb4cae42d0405aef1fcd30fb5bc184fcd41cfc6698cfd08169d3d2f62312cfaa44b912ef3dd0fc15ad658b6d8ef7eab0e95fdde1a9589bc7aa84ccdcba
6
+ metadata.gz: 14c91bdf8252460cc67e44f35eb670d354a2c192aa05bbbdbcdaa809e7b6c942fdc232c83ffd58a35dfd7b4cc2732f074462c64dc3261a9873b343e8992bb0fb
7
+ data.tar.gz: c3af83908ffffc46c20b00468d69c5d36e871c8a4d1be4bfa7ba90a3876cc78408fe44d82e79a7165cff1fe54fd0db32606d0434c5f24fb93bf1f1523fd16fba
data/CHANGELOG.md CHANGED
@@ -15,3 +15,7 @@
15
15
  ## 1.0.3 - 2023-03-16
16
16
 
17
17
  * Fix bugs byebug
18
+
19
+ ## 1.0.4 - 2023-11-13
20
+
21
+ * Add function copy configs add task copy config
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
- - **rake settings:consul2yml** - Get key/value variables from consul to `.yml` file
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Briefbag
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
@@ -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, [:consul_url, :consul_token, :project, :from_env, :to_env] do |_t, args|
35
- project = args[:project]
36
- from = args[:from_env]
37
- to = args[:to_env]
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 = args[:consul_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
- keys = Diplomat::Kv.get("#{from}/#{project}", keys: true)
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}/#{project}/#{config_name}")
55
- Diplomat::Kv.put("#{to}/#{project}/#{config_name}", config)
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.3
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-03-22 00:00:00.000000000 Z
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.0.9
200
+ rubygems_version: 3.1.6
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Briefbag manage your config