secrets support
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Paolo Asperti 2023-12-04 17:26:06 +01:00
parent 2a25c2771b
commit f4119771e1
Signed by: paspo
GPG Key ID: 06D46905D19D5182
2 changed files with 14 additions and 3 deletions

View File

@ -18,6 +18,7 @@ services:
- /dev/net/tun # needed for tap access
environment:
VPN_PASSWORD: "ThePassw0rd"
# VPN_PASSWORD_FILE: /run/secrets/MYPASSWD # example with docker secrets file
SERVER: vpn.server.it
LIC_FILE: /config/vpn.lic
volumes:

View File

@ -18,18 +18,28 @@ CONFIGFILE="${CONFIGDIR}/barracudavpn.conf"
mkdir -p "${CONFIGDIR}"
if [ -z "${VPN_PASSWORD}" ]; then
echo "You need to specify the password (VPN_PASSWORD env variable)"
if [ -z "${VPN_PASSWORD}${VPN_PASSWORD_FILE}" ]; then
echo "You need to specify the password (VPN_PASSWORD or VPN_PASSWORD_FILE env variable)"
exit 1
fi
if [ ! -z "${VPN_PASSWORD_FILE}" ]; then
if [ ! -r "${LIC_FILE}" ]; then
echo "The specified password file (${VPN_PASSWORD_FILE}) is not readable"
exit 1
fi
fi
VPN_PASSWORD_FILE_CONTENT=$(cat "${VPN_PASSWORD_FILE}")
VPN_PASSWORD=${VPN_PASSWORD:-$VPN_PASSWORD_FILE_CONTENT}
if [ -z "${LIC_FILE}" ]; then
echo "You need to specify the path to the license file (LIC_FILE env variable)"
exit 1
fi
if [ ! -r "${LIC_FILE}" ]; then
echo "The license file is not readable"
echo "The license file (${LIC_FILE}) is not readable"
exit 1
fi