forked from jkroepke/helm-secrets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·142 lines (121 loc) · 3.17 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env sh
set -euf
# Path to current directory
SCRIPT_DIR="$(dirname "$0")"
# Create temporary directory
TMPDIR="${HELM_SECRETS_DEC_TMP_DIR:-$(mktemp -d)}"
# Output debug infos
QUIET="${HELM_SECRETS_QUIET:-false}"
# Define the secret driver engine
SECRET_DRIVER="${HELM_SECRETS_DRIVER:-sops}"
# The suffix to use for decrypted files. The default can be overridden using
# the HELM_SECRETS_DEC_SUFFIX environment variable.
DEC_SUFFIX="${HELM_SECRETS_DEC_SUFFIX:-.yaml.dec}"
DEC_DIR="${HELM_SECRETS_DEC_DIR:-}"
# Make sure HELM_BIN is set (normally by the helm command)
HELM_BIN="${HELM_BIN:-helm}"
# shellcheck source=scripts/lib/common.sh
. "${SCRIPT_DIR}/lib/common.sh"
# shellcheck source=scripts/lib/file.sh
. "${SCRIPT_DIR}/lib/file.sh"
# shellcheck source=scripts/lib/http.sh
. "${SCRIPT_DIR}/lib/http.sh"
trap _trap EXIT
load_secret_driver "$SECRET_DRIVER"
while true; do
case "${1:-}" in
enc)
# shellcheck source=scripts/commands/enc.sh
. "${SCRIPT_DIR}/commands/enc.sh"
if [ $# -lt 2 ]; then
enc_usage
echo "Error: secrets file required."
exit 1
fi
enc "$2"
break
;;
dec)
# shellcheck source=scripts/commands/dec.sh
. "${SCRIPT_DIR}/commands/dec.sh"
if [ $# -lt 2 ]; then
dec_usage
echo "Error: secrets file required."
exit 1
fi
dec "$2"
break
;;
view)
# shellcheck source=scripts/commands/view.sh
. "${SCRIPT_DIR}/commands/view.sh"
if [ $# -lt 2 ]; then
view_usage
echo "Error: secrets file required."
exit 1
fi
view "$2"
break
;;
edit)
# shellcheck source=scripts/commands/edit.sh
. "${SCRIPT_DIR}/commands/edit.sh"
if [ $# -lt 2 ]; then
edit_usage
echo "Error: secrets file required."
exit 1
fi
edit "$2"
break
;;
clean)
# shellcheck source=scripts/commands/clean.sh
. "${SCRIPT_DIR}/commands/clean.sh"
if [ $# -lt 2 ]; then
clean_usage
echo "Error: Chart package required."
exit 1
fi
clean "$2"
break
;;
dir)
dirname "${SCRIPT_DIR}"
break
;;
downloader)
# shellcheck source=scripts/commands/downloader.sh
. "${SCRIPT_DIR}/commands/downloader.sh"
downloader "$2" "$3" "$4" "$5"
break
;;
--help | -h | help)
# shellcheck source=scripts/commands/help.sh
. "${SCRIPT_DIR}/commands/help.sh"
help_usage
break
;;
--driver | -d)
load_secret_driver "$2"
shift
;;
--quiet | -q)
# shellcheck disable=SC2034
QUIET=true
;;
"")
# shellcheck source=scripts/commands/help.sh
. "${SCRIPT_DIR}/commands/help.sh"
help_usage
exit 1
;;
*)
# shellcheck source=scripts/commands/helm.sh
. "${SCRIPT_DIR}/commands/helm.sh"
helm_command "$@"
break
;;
esac
shift
done
exit 0