Add function to load secret/password from file for security (#25)
New feature: Load SMTP password from file to avoid using env variables.
This commit is contained in:
3
run.sh
3
run.sh
@@ -13,6 +13,9 @@ function add_config_value() {
|
||||
postconf -e "${key} = ${value}"
|
||||
}
|
||||
|
||||
# Read password from file to avoid unsecure env variables
|
||||
if [ -n "${SMTP_PASSWORD_FILE}" ]; then [ -f "${SMTP_PASSWORD_FILE}" ] && read SMTP_PASSWORD < ${SMTP_PASSWORD_FILE} || echo "SMTP_PASSWORD_FILE defined, but file not existing, skipping."; fi
|
||||
|
||||
[ -z "${SMTP_SERVER}" ] && echo "SMTP_SERVER is not set" && exit 1
|
||||
[ -z "${SMTP_USERNAME}" ] && echo "SMTP_USERNAME is not set" && exit 1
|
||||
[ -z "${SMTP_PASSWORD}" ] && echo "SMTP_PASSWORD is not set" && exit 1
|
||||
|
||||
Reference in New Issue
Block a user