0

I'm testing bluemix, but I'm lost.

I want deploy an Node APP from a GIT repo. For this I created a GIT project in hub.jazz, I commited and pushed, and I added two steps for deployment, one for build and other for deploy. All this works OK.

But my problem occurs with the envirorment variables. I want that each environment uses different variables of configuration, but is impossible set from deploy task. I only can I set these variables in bluemix cfapp application. But this is not good for me, because this application not's exists in the moment of deployment.

How I need to do this? What is the best way for deploy in PRE and PROD environments with differents configurations?

Thanks.

vmovva
  • 681
  • 3
  • 19
user1710825
  • 578
  • 5
  • 15

2 Answers2

1

If you would like to set environment variables to an app, you can do it this way (to ensure that the app exists when you set the environment variables):

1. cf push <appName> --no-start
2. cf set-env <appName> <varName1> "<varValue1>"
3. cf set-env <appName> <varName2> "<varValue2>"
...cf set-env <appName> <varNameN> "<varValueN>"
...
n. cf restart <appName>
0

Have you tried creating two stages for deployment--one for your "PRE" and one for your "PROD?" That way, you can reuse the same sets of environment variables without any problems.

mbridges
  • 146
  • 4
  • Hi, yes, I have two stages. The problem is that the enviroment variables inside the stage are only for deployment (useful for example if you want use this variables for some tests or things like this) I found a solution, in the comand of cf push I use extra command: cf push {{APP_NAME}} --command "export app_password=123 && node app" (Something like this, I don't remember what exactly) – user1710825 Mar 30 '16 at 23:30