Abhishek Chatterjee
Abhishek Chatterjee

Reputation: 2049

Supervisord configured Environment variable in Java process

My java process takes a env variable "config". It works when I shoot the process from command line with "java -Dconfig=... ..."

Now I have configured Supervisord and added the programs. I also have added the below entry under supervisor tag in conf file

environment=KEY="value",config="my path"

I think this value should be propagated to all child processes, hence my child java process should be able to access it with System.getProperty(). But it is not getting any env variable with name "config".

Any help :)

Upvotes: 0

Views: 1961

Answers (1)

vempo
vempo

Reputation: 3153

The environment configuration parameter of Supervisord is for operating system (Linux) environment variables. Parameters passed using -D, on the other hand, are JVM options. The correct way is to pass JVM options in command.

command=java -Dconfig=... 

Don't forget quotes if a command argument contains spaces. See http://supervisord.org/configuration.html#program-x-section-values

Upvotes: 1

Related Questions