secrets_cli 1.11.0 → 1.12.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6af10caecd588872e7b6b71370738b48f7724ea57780e3f25617723e5bbd7c1a
4
- data.tar.gz: 3547a5dac42ca6ae752e6fd60fbf330e3da9b85d00a685b7deb9cff01805aff2
3
+ metadata.gz: 4f49c6ff102690ea82d4b6690fd57f4b68623e5844254b152a50cce069e10865
4
+ data.tar.gz: 001b8aa6ea425a1811d443fbfa8104bf318baacb22e14444524abbd96f0ef429
5
5
  SHA512:
6
- metadata.gz: 3efd83f8f1abcfc6d61188531be16e7e9f9e93386a89b27c9bb56f2dd6710e5e6ec05282008fd5702e17652a3455ae1934696e14aad774942f0957e6ec022cca
7
- data.tar.gz: e923815d6e97e9b0f1cf36216863cc16cfa71f7a43eca53263eb47df4148d4deed60e47827d1482e782d53a01fe52cc9fc49aaf397dee3b9cdca7094f98cf032
6
+ metadata.gz: dcc6685035d12ac48c5ebaf2afbf753891a2e652816a4e1f24a7aedaafd5c62adcbdc4718b2ce8f8502b8caed9665c539480d9a87a060d7c99e26193db5fda77
7
+ data.tar.gz: d908edd9fa492a679e576984980fb45cf9498faa39c19df0fbecebd6c1d748d010a2a6853e7f19626542d5d4b0ec13b69de43923b2ab12f0b9b9818a3cc93c05
data/exe/secrets CHANGED
@@ -28,7 +28,7 @@ command :policies do |c|
28
28
  c.summary = 'Check what policies your auth has'
29
29
  c.action do |_args, options|
30
30
  options.default verbose: true
31
- SecretsCli::Vault::Auth.new(options).call
31
+ SecretsCli::Vault::Policies.new(options).call
32
32
  end
33
33
  end
34
34
 
@@ -41,7 +41,6 @@ command :pull do |c|
41
41
  c.option '-k', '--secrets_storage_key STRING', String, 'Override secrets_storage_key'
42
42
  c.option '-d', '--secrets_dir STRING', String, 'Override secrets_dir, default: "."'
43
43
  c.action do |_args, options|
44
- SecretsCli::Vault::Auth.new(options).call
45
44
  SecretsCli::Vault::Pull.new(options).call
46
45
  end
47
46
  end
@@ -54,7 +53,6 @@ command :push do |c|
54
53
  c.option '-f', '--secrets_file STRING', String, 'Override secrets_file'
55
54
  c.option '-k', '--secrets_storage_key STRING', String, 'Override secrets_storage_key'
56
55
  c.action do |_args, options|
57
- SecretsCli::Vault::Auth.new(options).call
58
56
  SecretsCli::Vault::Push.new(options).call
59
57
  end
60
58
  end
@@ -65,7 +63,6 @@ command :read do |c|
65
63
  c.option '-e', '--environment STRING', String, 'Set environment, default: development'
66
64
  c.option '-k', '--secrets_storage_key STRING', String, 'Override secrets_storage_key'
67
65
  c.action do |_args, options|
68
- SecretsCli::Vault::Auth.new(options).call
69
66
  SecretsCli::Vault::Read.new(options).call
70
67
  end
71
68
  end
@@ -76,7 +73,6 @@ command :edit do |c|
76
73
  c.option '-e', '--environment STRING', String, 'Set environment, default: development'
77
74
  c.option '-k', '--secrets_storage_key STRING', String, 'Override secrets_storage_key'
78
75
  c.action do |_args, options|
79
- SecretsCli::Vault::Auth.new(options).call
80
76
  SecretsCli::Vault::Edit.new(options).call
81
77
  end
82
78
  end
@@ -86,7 +82,6 @@ command :list do |c|
86
82
  c.summary = 'Use to list all environemnts'
87
83
  c.option '-k', '--secrets_storage_key STRING', String, 'Override secrets_storage_key'
88
84
  c.action do |_args, options|
89
- SecretsCli::Vault::Auth.new(options).call
90
85
  SecretsCli::Vault::List.new(options).call
91
86
  end
92
87
  end
data/lib/secrets_cli.rb CHANGED
@@ -19,6 +19,7 @@ require 'secrets_cli/vault/read'
19
19
  require 'secrets_cli/vault/pull'
20
20
  require 'secrets_cli/vault/push'
21
21
  require 'secrets_cli/vault/edit'
22
+ require 'secrets_cli/vault/policies'
22
23
  require 'secrets_cli/version'
23
24
 
24
25
  # require 'pry'
@@ -21,16 +21,16 @@ module SecretsCli
21
21
  def command
22
22
  case auth_method
23
23
  when 'github'
24
- vault.auth.github(auth_token)
24
+ ::Vault.auth.github(auth_token)
25
25
  when 'token'
26
- vault.auth.token(auth_token)
26
+ ::Vault.auth.token(auth_token)
27
27
  when 'app_id'
28
- vault.auth.app_id(auth_app_id, auth_user_id)
28
+ ::Vault.auth.app_id(auth_app_id, auth_user_id)
29
29
  when 'approle'
30
- vault.auth.approle(auth_role_id, auth_secret_id)
30
+ ::Vault.auth.approle(auth_role_id, auth_secret_id)
31
31
  else
32
32
  error! "Unknown auth method #{auth_method}"
33
- end.auth.policies
33
+ end.auth
34
34
  end
35
35
  end
36
36
  end
@@ -10,7 +10,7 @@ module SecretsCli
10
10
  end
11
11
 
12
12
  def call
13
- options.verbose ? prompt.ok(command) : command
13
+ options.verbose ? prompt.ok(command).first : command
14
14
  rescue => exception
15
15
  # require 'pry'; binding.pry
16
16
  error!(exception.message)
@@ -23,7 +23,11 @@ module SecretsCli
23
23
  end
24
24
 
25
25
  def vault
26
- @vault ||= ::Vault::Client.new(address: config.vault_addr)
26
+ @vault ||=
27
+ ::Vault::Client.new(
28
+ address: config.vault_addr,
29
+ token: SecretsCli::Vault::Auth.new(options).call.client_token
30
+ )
27
31
  end
28
32
 
29
33
  def secrets_full_storage_key
@@ -0,0 +1,17 @@
1
+ module SecretsCli
2
+ module Vault
3
+ class Policies < SecretsCli::Vault::Base
4
+ def initialize(options)
5
+ super
6
+ end
7
+
8
+ private
9
+
10
+ attr_reader :secrets_storage_key
11
+
12
+ def command
13
+ SecretsCli::Vault::Auth.new(options).call.policies
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module SecretsCli
2
- VERSION = '1.11.0'
2
+ VERSION = '1.12.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secrets_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-21 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,6 +154,7 @@ files:
154
154
  - lib/secrets_cli/vault/base.rb
155
155
  - lib/secrets_cli/vault/edit.rb
156
156
  - lib/secrets_cli/vault/list.rb
157
+ - lib/secrets_cli/vault/policies.rb
157
158
  - lib/secrets_cli/vault/pull.rb
158
159
  - lib/secrets_cli/vault/push.rb
159
160
  - lib/secrets_cli/vault/read.rb