19 lines
544 B
Bash
19 lines
544 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
NGINX_PROXY_NAME="${NGINX_PROXY_CONTAINER_NAME:-nginx-proxy}"
|
|
|
|
TARGET_DOMAIN=$(echo "$MINIO_PUBLIC_URL" | sed -E 's#^https?://##; s#/.*##; s#:.*##')
|
|
|
|
if [ -n "$TARGET_DOMAIN" ]; then
|
|
IP=$(getent hosts "$NGINX_PROXY_NAME" | awk '{ print $1 }' | head -n1)
|
|
|
|
if [ -n "$IP" ]; then
|
|
echo "$IP $TARGET_DOMAIN" >> /etc/hosts
|
|
echo "[entrypoint] resolved $NGINX_PROXY_NAME -> $IP for $TARGET_DOMAIN"
|
|
else
|
|
echo "[entrypoint] WARNING: could not resolve $NGINX_PROXY_NAME, using public DNS as fallback"
|
|
fi
|
|
fi
|
|
|
|
exec "$@" |