Browse Source

use env file to map filesystem locations

Steven Jacobs 3 years ago
parent
commit
e625a352d0
5 changed files with 15 additions and 9 deletions
  1. 2 0
      .env.example
  2. 1 0
      .gitignore
  3. 3 1
      README.md
  4. 3 2
      docker-compose.yml
  5. 6 6
      liquidsoap/radio.liq

+ 2 - 0
.env.example

@@ -0,0 +1,2 @@
+RADIO_MUSIC_DIR=/srv/audio/music
+RADIO_JINGLE_DIR=/srv/audio/jingles

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.env

+ 3 - 1
README.md

@@ -17,7 +17,9 @@ You have two options to get up and running.
 ### Docker Compose
 
 1. Clone this repo.
-2. Edit `docker-compose.yml` and add your host volumes for music, playlists and/or database, then:
+2. Copy `.env.example` to `.env`.
+3. Edit the paths in `.env` to match the sources for music and jingles on the host.
+4. Turn it up.
 
 ```txt
 $ docker-compose up -d

+ 3 - 2
docker-compose.yml

@@ -9,12 +9,13 @@ services:
       - backend
 
   liquidsoap:
+    env_file: .env
     build:
       context: liquidsoap/
     image: liquidsoap:latest
     volumes:
-      - "~/Music:/srv/sources/songs:ro"
-      - "~/Audio/Jingles:/srv/sources/jingles:ro"
+      - "${RADIO_MUSIC_DIR}:/srv/audio/music:ro"
+      - "${RADIO_JINGLES_DIR}:/srv/audio/jingles:ro"
     networks:
       - backend
 

+ 6 - 6
liquidsoap/radio.liq

@@ -5,17 +5,17 @@ set("server.telnet",true)
 
 %include "./library.liq"
 
-songs = playlist(
-    "/srv/sources/songs",
+music = playlist(
+    "/srv/audio/music",
     conservative=true)
 
 jingles = playlist(
-    "/srv/sources/jingles",
+    "/srv/audio/jingles",
     conservative=true)
 
-s = rotate(weights=[1,3], [jingles, songs])
+m = rotate(weights=[1,3], [jingles, music])
 
-s = on_metadata(apply_metadata,s)
+m = on_metadata(apply_metadata,m)
 
 output.icecast(
     %vorbis,
@@ -25,4 +25,4 @@ output.icecast(
     password="hackme",
     fallible=true,
     mount="radio.ogg",
-    s)
+    m)