mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
dad3e1da7c
with PUID and PGID environment variables - Detects if image is run with a user in docker command and fails if so - Adds s6 prepare scripts for adding a 'npmuser' - Split up and refactor the s6 prepare scripts - Runs nginx and backend node as 'npmuser' - Changes ownership of files required at startup
37 lines
927 B
Bash
37 lines
927 B
Bash
#!/bin/bash
|
|
|
|
# This command reads the `DISABLE_IPV6` env var and will either enable
|
|
# or disable ipv6 in all nginx configs based on this setting.
|
|
|
|
log_info 'IPv6 ...'
|
|
|
|
# Lowercase
|
|
DISABLE_IPV6=$(echo "${DISABLE_IPV6:-}" | tr '[:upper:]' '[:lower:]')
|
|
|
|
process_folder () {
|
|
FILES=$(find "$1" -type f -name "*.conf")
|
|
SED_REGEX=
|
|
|
|
if [ "$DISABLE_IPV6" == "true" ] || [ "$DISABLE_IPV6" == "on" ] || [ "$DISABLE_IPV6" == "1" ] || [ "$DISABLE_IPV6" == "yes" ]; then
|
|
# IPV6 is disabled
|
|
echo "Disabling IPV6 in hosts in: $1"
|
|
SED_REGEX='s/^([^#]*)listen \[::\]/\1#listen [::]/g'
|
|
else
|
|
# IPV6 is enabled
|
|
echo "Enabling IPV6 in hosts in: $1"
|
|
SED_REGEX='s/^(\s*)#listen \[::\]/\1listen [::]/g'
|
|
fi
|
|
|
|
for FILE in $FILES
|
|
do
|
|
echo "- ${FILE}"
|
|
sed -E -i "$SED_REGEX" "$FILE"
|
|
done
|
|
|
|
# ensure the files are still owned by the npmuser
|
|
chown -R npmuser:npmuser "$1"
|
|
}
|
|
|
|
process_folder /etc/nginx/conf.d
|
|
process_folder /data/nginx
|