encrypt_env 0.0.2 → 0.0.5
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/bin/encrypt_env +23 -28
- data/lib/encrypt_env.rb +10 -0
- 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: 9ab6d991673d2cd86aceb958a779d65270c5695ed39225daf94ba388ec3ad952
|
4
|
+
data.tar.gz: d632e22a34226ded4fcf845cb2539b905b45fb982e1bae587b785275e59514b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b856ac94e163a912dae37a78c5222c7b3e099d7c11681fd00b2d916d8259c527b824dadd8faf19d2b39e8e0475e5cbcf43b497875af84f1be2576c1efcfb7759
|
7
|
+
data.tar.gz: 832f23b5b2733465b999b7f71a5f135ec2800fe1cff86a326998f4ab5968efffd4e575e4fc3ccb9ae6c7522688fbb20b087306bf416bbc90508de846f20665da
|
data/bin/encrypt_env
CHANGED
@@ -4,37 +4,32 @@
|
|
4
4
|
|
5
5
|
require 'encrypt_env'
|
6
6
|
|
7
|
-
COMMANDS = {
|
8
|
-
'setup' => EncryptEnv.setup,
|
9
|
-
'secrets' => EncryptEnv.secrets,
|
10
|
-
'secrets_all' => EncryptEnv.secrets_all,
|
11
|
-
'edit' => EncryptEnv.edit
|
12
|
-
}.freeze
|
13
|
-
|
14
7
|
argv = ARGV
|
15
8
|
action = argv.shift
|
16
|
-
command_class = COMMANDS[action]
|
17
|
-
unless command_class
|
18
|
-
if ['help', '--help', '-h'].include?(action)
|
19
|
-
puts <<~HELP
|
20
|
-
Usage:
|
21
|
-
encrypt_env setup
|
22
|
-
encrypt_env secrets
|
23
|
-
encrypt_env secrets_all
|
24
|
-
encrypt_env edit
|
25
|
-
HELP
|
26
9
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
10
|
+
if action == 'setup'
|
11
|
+
EncryptEnv.setup
|
12
|
+
exit 0
|
13
|
+
elsif action == 'show'
|
14
|
+
EncryptEnv.show
|
15
|
+
exit 0
|
16
|
+
elsif action == 'all'
|
17
|
+
EncryptEnv.show_all
|
18
|
+
exit 0
|
19
|
+
elsif action == 'edit'
|
20
|
+
EncryptEnv.edit
|
21
|
+
exit 0
|
22
|
+
elsif ['help', '--help', '-h'].include?(action)
|
23
|
+
puts <<~HELP
|
24
|
+
Usage:
|
25
|
+
encrypt_env setup
|
26
|
+
encrypt_env secrets
|
27
|
+
encrypt_env secrets_all
|
28
|
+
encrypt_env edit
|
29
|
+
HELP
|
33
30
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
rescue ArgumentError => e
|
38
|
-
puts e.message
|
31
|
+
exit 0
|
32
|
+
else
|
33
|
+
puts "Unknown action: #{action}"
|
39
34
|
exit 1
|
40
35
|
end
|
data/lib/encrypt_env.rb
CHANGED
@@ -82,6 +82,8 @@ class EncryptEnv
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def self.secrets
|
85
|
+
return @decrypted if @decrypted
|
86
|
+
|
85
87
|
path_root unless @path_root
|
86
88
|
@decrypted = HashWithIndifferentAccess.new(YAML.safe_load(
|
87
89
|
decrypt, aliases: true
|
@@ -112,4 +114,12 @@ class EncryptEnv
|
|
112
114
|
secrets unless @decrypted
|
113
115
|
@decrypted[:staging]
|
114
116
|
end
|
117
|
+
|
118
|
+
def self.show
|
119
|
+
puts secrets.inspect
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.show_all
|
123
|
+
puts secrets_all.inspect
|
124
|
+
end
|
115
125
|
end
|