diff --git a/docker/environment.sh.template b/docker/environment.sh.template index b52c14c..f5d6cba 100755 --- a/docker/environment.sh.template +++ b/docker/environment.sh.template @@ -16,3 +16,8 @@ export ASTEROID_DB_PASSWORD=asteroid_db_2025 # Set to 'true' ONLY on production (asteroid.radio) # Leave unset or 'false' for development to avoid polluting public listings # export ICECAST_ENABLE_YP=true + +# Icecast Hostname (reported to YP directories) +# Production should set this to the public hostname +# Dev defaults to 'localhost' if unset +# export ICECAST_HOSTNAME=ice.asteroid.radio diff --git a/docker/icecast-entrypoint.sh b/docker/icecast-entrypoint.sh index d08d62c..90990d3 100644 --- a/docker/icecast-entrypoint.sh +++ b/docker/icecast-entrypoint.sh @@ -1,10 +1,16 @@ #!/bin/sh # Generate icecast.xml from base config -# If ICECAST_ENABLE_YP=true, insert YP directory blocks +# - Substitute hostname (defaults to localhost for dev) +# - If ICECAST_ENABLE_YP=true, insert YP directory blocks cp /etc/icecast.xml.base /etc/icecast.xml +# Set hostname (defaults to localhost if not specified) +ICECAST_HOSTNAME=${ICECAST_HOSTNAME:-localhost} +echo "Icecast hostname: $ICECAST_HOSTNAME" +sed -i "s|localhost|$ICECAST_HOSTNAME|" /etc/icecast.xml + if [ "$ICECAST_ENABLE_YP" = "true" ]; then echo "YP directory publishing ENABLED" # Insert YP config before closing tag