I'm designing a systemd service file for some plugin. I need to include two environment files there: first for the main program (let it be main.env
), second — for the plugin (plugin.env
). The plugin needs some variable VAR
to be defined before it is started.
Sometimes users may want to define this variable in main.env
, sometimes this variable may be missing, and actually I have no control on the environment file of the main program, this variable may be removed from it in the next release as non-obligatory.
So I want to provide a fallback value for the variable, but only in case it is not set yet. Also I want this fallback value to be actually defined in plugin.env
so that users may change this value locally without losing it after update, and I use this variable at the same file to set next variables.
In bash, what I want looks like: : ${VAR:=fallback_value}
. Is it possible to write this in systemd environment file?
I've looked through the manual (here), but, alas, found nothing relevant.