mirror of
https://github.com/pschiffe/docker-pdns.git
synced 2025-01-18 19:11:14 +01:00
f14e4be008
There's now pdns 4.9 also in Fedora version.
35 lines
855 B
Bash
Executable file
35 lines
855 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
#### Function definitions
|
|
|
|
deriveConfigValuesFromEnvironment() {
|
|
# 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
|
|
|
|
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
|
|
deriveConfigValuesFromEnvironment
|
|
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
|
|
|
|
exec "$@"
|