docker-pdns/pdns-recursor/docker-entrypoint.sh

36 lines
857 B
Bash
Raw Permalink Normal View History

#!/bin/sh
2023-12-19 23:12:51 +01:00
set -eu
#### Function definitions
deriveConfigValuesFromEnvrionement() {
# Configure base vars
: "${PDNS_local_port:=53}"
: "${PDNS_local_address:=0.0.0.0}"
: "${PDNS_allow_from:=0.0.0.0/0}"
export PDNS_local_port PDNS_local_address PDNS_allow_from
}
### End of function definitions
2018-11-06 22:51:45 +01:00
if [ -f /etc/fedora-release ]; then
config_file=/etc/pdns-recursor/recursor.conf
pdns_user=pdns-recursor
elif [ -f /etc/alpine-release ]; then
config_file=/etc/pdns/recursor.conf
pdns_user=recursor
fi
if [ "${USE_EXISTING_CONFIG_FILE:-false}" = 'false' ]; then
deriveConfigValuesFromEnvrionement
echo "Generating config file from environment"
subvars --prefix 'PDNS_' < '/recursor.conf.tpl' > "${config_file}"
chown "${pdns_user}:" "${config_file}"
else
echo "Using existing config file ${config_file}"
fi
2018-11-22 19:45:43 +01:00
exec "$@"