-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
edit.sh
46 lines (34 loc) · 738 Bytes
/
edit.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
#!/usr/bin/env sh
set -euf
edit_usage() {
cat <<EOF
helm secrets [ OPTIONS ] edit <path to file>
Edit encrypted secrets
Decrypt encrypted file, edit and then encrypt
You can use plain sops to edit - https://github.com/getsops/sops
Example:
$ helm secrets edit <SECRET_FILE_PATH>
or $ sops <SECRET_FILE_PATH>
$ git add <SECRET_FILE_PATH>
$ git commit
$ git push
EOF
}
edit_helper() {
dir=$(dirname "$1")
file=$(basename "$1")
if [ ! -d "${dir}" ]; then
fatal 'Directory does not exist: %s' "${dir}"
fi
cd "$dir"
backend_edit_file "yaml" "${file}"
}
edit() {
echo "$1"
if is_help "$1"; then
edit_usage
return
fi
file="$1"
edit_helper "${file}"
}