Environment variable in jibri.conf?

I’m migrating from config.json to jibri.conf following the guide here.
I see that the configuration library allows to use environment variables, so I tried to use nickname = ${HOSTNAME} but then jibri doesn’t start with this error:


Exception in thread "main" java.lang.ExceptionInInitializerError
at org.jitsi.jibri.MainKt.handleCommandLineArgs(Main.kt:193)
at org.jitsi.jibri.MainKt.main(Main.kt:53)
Caused by: com.typesafe.config.ConfigException$UnresolvedSubstitution: /etc/jitsi/jibri/jibri.conf: 33: Could not resolve substitution to a value: ${HOSTNAME}

To exclude systemd problems, I created a dummy unit that just logs the environment variables to a file and I can see that the HOSTNAME variable is present in the environment.

is your ‘dummy unit’ jiust a bash script ? because HOSTNAME is a bash environment variable, it’s not available outside of bash scripts.

So isn’t it exported to the java process that the jibri launch.sh launches with exec?

don’t think so. Try it with your own shell: echo $HOSTNAME shows it, but printenv | grep HOSTNAME don’t.

Nope, it isn’t exported :slightly_frowning_face:

It works when the following is added into /opt/jitsi/jibri/launch.sh. I think this value is not in Jibri shell if it is not explicitly exported.

export HOSTNAME=$HOSTNAME

Thank you. I didn’t want to touch the launch script that comes with the deb package (I guess it would be overwritten when there’s an updated package).

It is only for information.

In my setups I create a systemd service which updates the nickname:

/etc/systemd/system/jibri-ephemeral-config.service
/usr/local/sbin/jibri-ephemeral-config

I simply added the hostname in the /etc/systemd/system/jibri.service.d/override.conf file:

[Service]
Environment="HOSTNAME=%H"
1 Like