1

What is the good way to set environment variable in supervisord using output from a file? I need like:

[program:prog1]
command=prog1 -param1 -param2
environment=PASSWORD=`cat .password`

I can use an additional script, but perhaps the better way exists:

[program:prog1]
command=start-prog1

start-prog1:

export PASSWORD=`cat .password`
start-prog1

1 Answer 1

-1

Environment variables that are present in the environment at the time that supervisord is started can be used in the configuration file using the Python string expression syntax %(ENV_X)s:

http://supervisord.org/configuration.html

You can use (in Bash)

export PASSWORD1=$(cat .password)

Then use this in the configuration file

environment = PASSWORD=%(PASSWORD1)s
3
  • I need to use different environment variables for each process, because some process can be started on a host and each process should have own password, that is impossible if I'll use one scrip for exporting variable and supervizord for starting processes.
    – Dimaf
    Dec 12, 2016 at 20:17
  • 1
    This does not work in Supervisor 3.2.
    – Newb
    Mar 27, 2017 at 22:29
  • @Newb do you know how to fix it in 3.2?
    – Kolyunya
    May 29, 2017 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .