I have an environment variable that I would like to set while starting an nginx service.
Let's say the environment variable is NGINX_SERVICE
which can have value DEV or QA. And I want to conditionally set upstream config.
ie, Logically something like this.
If ENV['NGINX_SERVICE'] == "DEV"
upstream backend {
server localhost:2222;
}
If ENV['NGINX_SERVICE'] == "QA"
upstream backend {
server qa-server1:2223;
server qa-server2:2223;
}
Any idea how to accomplish this ?