0

I've spent all night trying to get environment variables to take their value in Liquidsoap.

The result they return is always empty.

log("Variable SOURCE_PASSW: " ^ getenv("SOURCE_PASSW"))
log("Variable PASSWORD_DJ: " ^ getenv("PASSWORD_DJ"))
log("Variable PASSWORD_ADMIN: " ^ getenv("PASSWORD_ADMIN"))

2023/08/22 09:40:25 [lang:3] Variable SOURCE_PASSW: 
2023/08/22 09:40:25 [lang:3] Variable PASSWORD_DJ: 
2023/08/22 09:40:25 [lang:3] Variable PASSWORD_ADMIN: 

I have defined the environment variables here: /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
TELNET_USERNAME=client_metadata
TELNET_PASSWORD=985421
ADMIN_ICECAST=admin
PASSWORD_ADMIN=9632541
PASSWORD_DJ=20548798
SOURCE_PASSW=05897445
RELAY_PASSW=635478

In Ubuntu 22.04 SSH console they work fine:

icecast2@ip-17x-xx-xx-xxx:~/liquidsoap-daemon/script$ echo $PASSWORD_ADMIN

9632541

Icecast version: Icecast 2.4.4

Liquidsoap version: Liquidsoap 2.1.4 (installed with OCaml Package Manager (opam))

Does anyone know a way to make them work for me in the .liq script?

Juan
  • 195
  • 9

1 Answers1

0

I already found the solution. I forgot to mention that I use liquidsoap as a daemon. I edited the service file and added the line

[Service]
EnvironmentFile=/etc/environment

And that did the magic!:)

Juan
  • 195
  • 9