-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·27 lines (22 loc) · 891 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·27 lines (22 loc) · 891 Bytes
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
#!/bin/sh
# SwarmCD entrypoint, used to import gpg keys if needed
if [ ! -z "${SOPS_GPG_PRIVATE_KEY_FILE}" ]; then
echo "entrypoint.sh: importing gpg private key from file..."
gpg --import "${SOPS_GPG_PRIVATE_KEY_FILE}"
if [ $? -ne 0 ]; then
echo "entrypoint.sh: error: could not import GPG private key from file !"
exit 1
fi
echo "entrypoint.sh: gpg key imported from file successfully."
elif [ ! -z "${SOPS_GPG_PRIVATE_KEY}" ]; then
echo "entrypoint.sh: importing gpg private key from environment..."
echo "${SOPS_GPG_PRIVATE_KEY}" | gpg --import
if [ $? -ne 0 ]; then
echo "entrypoint.sh: error: could not import GPG private key from environment !"
exit 1
fi
echo "entrypoint.sh: gpg key imported from environment successfully."
else
echo "entrypoint.sh: no gpg key found, skipping import"
fi
exec "$@"