Browse Source

add more env variables

Steven Jacobs 2 years ago
parent
commit
ecbc8e9d66
3 changed files with 12 additions and 4 deletions
  1. 4 0
      .env.example
  2. 5 1
      icecast/docker-entrypoint.sh
  3. 3 3
      icecast/icecast.xml.template

+ 4 - 0
.env.example

@@ -1 +1,5 @@
 RADIO_MUSIC_DIR=/srv/audio/music
+ICECAST_ADMIN=icemaster@localhost
+ICECAST_HOSTNAME=icecast
+ICECAST_LOCATION=Earth
+ICECAST_PASSWORD=hackme

+ 5 - 1
icecast/docker-entrypoint.sh

@@ -2,7 +2,11 @@
 set -e
 
 if ls "/usr/share/icecast/icecast.xml.template" 1> /dev/null 2>&1; then
-    sed "s/{{ ICECAST_PASSWORD }}/${ICECAST_PASSWORD}/g" /usr/share/icecast/icecast.xml.template >| /usr/share/icecast/icecast.xml
+    sed -e "s/{{ ICECAST_ADMIN }}/${ICECAST_ADMIN}/g" \
+        -e "s/{{ ICECAST_HOSTNAME }}/${ICECAST_HOSTNAME}/g" \
+        -e "s/{{ ICECAST_LOCATION }}/${ICECAST_LOCATION}/g" \
+        -e "s/{{ ICECAST_PASSWORD }}/${ICECAST_PASSWORD}/g" \
+        /usr/share/icecast/icecast.xml.template >| /usr/share/icecast/icecast.xml
 fi
 
 exec "$@"

+ 3 - 3
icecast/icecast.xml.template

@@ -2,8 +2,8 @@
     <!-- location and admin are two arbitrary strings that are e.g. visible
          on the server info page of the icecast web interface
          (server_version.xsl). -->
-    <location>Earth</location>
-    <admin>icemaster@localhost</admin>
+    <location>{{ ICECAST_LOCATION }}</location>
+    <admin>{{ ICECAST_ADMIN }}</admin>
 
     <limits>
         <clients>100</clients>
@@ -54,7 +54,7 @@
     <!-- This is the hostname other people will use to connect to your server.
     It affects mainly the urls generated by Icecast for playlists and yp
     listings. -->
-    <hostname>icecast</hostname>
+    <hostname>{{ ICECAST_HOSTNAME }}</hostname>
 
     <!-- You may have multiple <listener> elements -->
     <listen-socket>