secret_hub 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/secret_hub/commands/bulk.rb +25 -7
- data/lib/secret_hub/config.rb +2 -7
- data/lib/secret_hub/exceptions.rb +0 -1
- data/lib/secret_hub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 366ad9f9647c8e1cfbbd9496b99ee1209fcd3a24b9409a59a68e81a880cbe90c
|
4
|
+
data.tar.gz: 79b6bc712815818a9f322d2d7cead7698bfa11179f81c0fac99aa1c90abc5ecb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07b10bd5e5d859b3f732d40470fdf84005b7052ef08f1865f36c5539e9741a2e47736c9513d17d77fca14935d4e08db0aaf8628df5b16de2db81bc62a16a89e6
|
7
|
+
data.tar.gz: 755121d143ca3faf0ed16391b2563827cf7788eaa8ffeb83931c595fba3bed822fc5e8a1eb2d737e010ba404670c57712fc394c41800c66edfafc332d22c0462
|
@@ -40,13 +40,10 @@ module SecretHub
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def show_command
|
43
|
-
visible = args['--visible']
|
44
|
-
|
45
43
|
config.each do |repo, secrets|
|
46
44
|
say "!txtblu!#{repo}:"
|
47
45
|
secrets.each do |key, value|
|
48
|
-
|
49
|
-
say " !txtpur!#{key}: !txtcyn!#{value}"
|
46
|
+
show_secret key, value, args['--visible']
|
50
47
|
end
|
51
48
|
end
|
52
49
|
end
|
@@ -62,12 +59,15 @@ module SecretHub
|
|
62
59
|
|
63
60
|
def save_command
|
64
61
|
clean = args['--clean']
|
62
|
+
skipped = 0
|
65
63
|
|
66
64
|
config.each do |repo, secrets|
|
67
65
|
say "!txtblu!#{repo}"
|
68
|
-
update_repo repo, secrets
|
66
|
+
skipped += update_repo repo, secrets
|
69
67
|
clean_repo repo, secrets.keys if clean
|
70
68
|
end
|
69
|
+
|
70
|
+
say "\nSkipped #{skipped} missing secrets" if skipped > 0
|
71
71
|
end
|
72
72
|
|
73
73
|
def clean_command
|
@@ -91,10 +91,28 @@ module SecretHub
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def update_repo(repo, secrets)
|
94
|
+
skipped = 0
|
95
|
+
|
94
96
|
secrets.each do |key, value|
|
95
97
|
say "save !txtpur!#{key} "
|
96
|
-
|
97
|
-
|
98
|
+
if value
|
99
|
+
github.put_secret repo, key, value
|
100
|
+
say "!txtgrn!OK"
|
101
|
+
else
|
102
|
+
say "!txtred!MISSING"
|
103
|
+
skipped += 1
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
skipped
|
108
|
+
end
|
109
|
+
|
110
|
+
def show_secret(key, value, visible)
|
111
|
+
if value
|
112
|
+
value = value.obfuscate unless visible
|
113
|
+
say " !txtpur!#{key}: !txtcyn!#{value}"
|
114
|
+
else
|
115
|
+
say " !txtpur!#{key}: !txtred!*MISSING*"
|
98
116
|
end
|
99
117
|
end
|
100
118
|
|
data/lib/secret_hub/config.rb
CHANGED
@@ -40,15 +40,10 @@ module SecretHub
|
|
40
40
|
secrets = [] unless secrets
|
41
41
|
|
42
42
|
if secrets.is_a? Hash
|
43
|
-
secrets.map { |key, value| [key, value ||
|
43
|
+
secrets.map { |key, value| [key, value || ENV[key]] }.to_h
|
44
44
|
elsif secrets.is_a? Array
|
45
|
-
secrets.map { |key| [key,
|
45
|
+
secrets.map { |key| [key, ENV[key]] }.to_h
|
46
46
|
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
def value_from_env(key)
|
51
|
-
ENV[key] || raise(MissingSecretError, "Please set the #{key} environment variable")
|
52
47
|
end
|
53
48
|
end
|
54
49
|
end
|
data/lib/secret_hub/version.rb
CHANGED