Mohan
Mohan

Reputation: 129

How to configure Dev, stage and production Env in Cloudfoundry?

Recently I moved my Spring MVC application from local server to CloudFoundry environment.

In my application I have an environment variable I set at server startup. i.e.

PROJ_ENV=-Dcom.abc.app.env=local

which is used spring config: <util:properties id="appProps" location="classpath:${com.abc.app.env}.application.properties" /> and the same is available in DEV, Stage and Production Servers and having respective application.properties file which contains environment specific values.

How I can maintain same setup in CloudFoundry? Is there any way to define environment/system variables?

Upvotes: 0

Views: 378

Answers (2)

Shia
Shia

Reputation: 1

Just an update, vmc has been deprecated since Cloud foundry v2. instead of VMC now its recommended to use

cf --help

Here is a detail link from vmc source..

Upvotes: 0

ebottard
ebottard

Reputation: 1997

You can set ENV variables with the vmc command line tool using vmc set-env appname varname value.

Have a look at vmc help --all for more info. Also, be aware that env variables names with dots in them are sometimes problematic, this is why Spring sometimes uses capital with underscores as alternatives.

Upvotes: 1

Related Questions