briefbag 1.0.2 → 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: 66b7c96c40783d727444f581e65f520eaadd8b4d249e2887ffc9d0ed20b40dbc
4
- data.tar.gz: f6e0ef37c64612473441876a50eb0fa5b1270c726774aef289a1c687fa4957e0
3
+ metadata.gz: 1bcd65204c8125e2a23ae6706f2697ac20110f48b8223e43ec9b5aa2265599f8
4
+ data.tar.gz: 645010474f211ab098bca35fa575fda18c5980d8797bcd7383d775d138064d58
5
5
  SHA512:
6
- metadata.gz: d4e9e34c7455c10f69898525de740da05e3bde3776c818afc527768c05af05bd25fa374df28a1e12768034bcbd51b6509666a847e7ef82f1626adac8c1fb2f6a
7
- data.tar.gz: ce47693102526f590fbd87b88f2b33b86cc562e76814953b5a8e9d221a8453f8c1371483c565a3633a81402234908c3ef7b2033baf1d415ae12c374fb8fca65d
6
+ metadata.gz: 14c91bdf8252460cc67e44f35eb670d354a2c192aa05bbbdbcdaa809e7b6c942fdc232c83ffd58a35dfd7b4cc2732f074462c64dc3261a9873b343e8992bb0fb
7
+ data.tar.gz: c3af83908ffffc46c20b00468d69c5d36e871c8a4d1be4bfa7ba90a3876cc78408fe44d82e79a7165cff1fe54fd0db32606d0434c5f24fb93bf1f1523fd16fba
data/CHANGELOG.md CHANGED
@@ -11,3 +11,11 @@
11
11
  ## 1.0.2 - 2023-03-16
12
12
 
13
13
  * Refactoring: delete anyway config, using yml from ruby, change params and upd docs, implementation rake tasks
14
+
15
+ ## 1.0.3 - 2023-03-16
16
+
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.2'
4
+ VERSION = '1.0.4'
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'briefbag'
4
- require 'byebug'
5
4
  require 'rails'
6
5
 
7
6
  namespace :settings do
@@ -32,13 +31,14 @@ namespace :settings do
32
31
  end
33
32
 
34
33
  desc 'Transfer configs file in consul from/to projects'
35
- task :transfer_config, [:consul_url, :consul_token, :project, :from_env, :to_env] do |_t, args|
36
- project = args[:project]
37
- from = args[:from_env]
38
- 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]
39
39
 
40
40
  Diplomat.configure do |config|
41
- config.url = args[:consul_url]
41
+ config.url = url
42
42
  config.options = {
43
43
  ssl: { version: :TLSv1_2 },
44
44
  headers: {
@@ -46,21 +46,20 @@ namespace :settings do
46
46
  }
47
47
  }
48
48
  end
49
- keys = Diplomat::Kv.get("#{from}/#{project}", keys: true)
49
+
50
+ keys = Diplomat::Kv.get(from.to_s, keys: true)
50
51
  keys.delete_at(0) # delete self name folder
51
52
  config_names = keys.map { |k| k.split('/').last }
52
53
 
53
54
  config_names.each do |config_name|
54
55
  warn Rainbow("Start read data for key: #{config_name}").yellow
55
- config = Diplomat::Kv.get("#{from}/#{project}/#{config_name}")
56
- Diplomat::Kv.put("#{to}/#{project}/#{config_name}", config)
56
+ config = Diplomat::Kv.get("#{from}/#{config_name}")
57
+ Diplomat::Kv.put("#{to}/#{config_name}", config)
57
58
  warn Rainbow("Success transfer data for key: #{config_name}").green
58
59
  end
59
60
  end
60
61
 
61
-
62
62
  desc 'create application.yml from template'
63
63
  task template2yml: :environment do
64
- p 'ya rake task'
65
64
  end
66
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.2
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-19 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