Notice: This resource is no longer being actively maintained and as a result some information may be out of date or inaccurate. Please see for technical instructions or for support related concerns.
RUN@cloud » Environment variables, configuration parameters and system properties

Environment variables, configuration parameters and system properties

Last modified by Cyrille Le Clerc on 2013/08/14 17:55

When you are deploying, ideally you will parameterize your apps for things like database connections, endpoints, api keys, whatever you want. 

This means you can avoid baking them into the binary - this is both convenient and safe (in the case of passwords). 

The CloudBees SDK "bees config" commands provide a way to externalize configuration configuration parameters from the application archive file. Configuration parameters can be attached to a specific application ID (application parameters) or an account (global parameters). Global parameters are available to all applications of the account.

Note: restart your application after making config changes. 

In CloudBees there are 2 main ways this happens: binding and configuration variables.

Persistence of variables

Variables are stored encrypted, and provided to your application as it starts. They only need to be set once - any subsequent deploys will use the last values you set as the variables.

Binding resources to applications

This is for things like CloudBees managed services (Databases, Session stores, SSL) - and is covered in this article on binding resources. When you use this - it is injecting variables/environment variables into your app for you. 

Binding a database example

This will bind an app and a db together:

bees app:bind -a APP_ID -db DB_ID -as DATASOURCE_NAME maxActive=5 maxIdle=2 \
maxWait=10000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true \
validationQuery="SELECT 1" testOnBorrow=true

In this case, the parameters and the end are customizing the connection pool settings (but are optional).

Read more on binding

Config and Environment Variables

There are 3 types: platform parameters (control how cloudbees behaves - eg proxyBuffering), application variables (anything you like - database urls, application variables) and finally runtime parameters (tells the container how to run - eg what version of jvm, for example.)

Platform variables

These are settings that change how CloudBees may treat your application, and are covered in the Bees SDK docs in the built-in platform parameters section.

Application parameters and Environment variables

The application config parameters set via bees config:set are available via system properties (System.getProperty) for the jvm stacks or environment variables for the non jvm based stacks.

You can see what is set using the bees config:list command.

Runtime parameters

These are set similar to the above via bees config:set, but using the -R prefix, like classpath for the java stack or java_version for all java stacks (you probably won't use these that much - more for overriding default behavior).

Cloudbees-web.xml config file (legacy)

The cloudbees-web.xml provides some other ways to work with servlet containers - it is optional, and considered legacy (maybe one day to be retired).

Configuration parameter commands

Here is some of the SDK commands to manage configuration parameters (you can run bees config to get help):


List configuration parameters.

usage: bees config:list [options]
 -a, --appid <arg>         CloudBees application ID
 -ac,--account <arg>      CloudBees account name
 -g,--global               Global account parameters
 -fi, --file <arg>         Output file name

Example: List configuration parameters of the application “test” and export them in the test_param.xml file

bees config:list -a test -fi test_param.xml

The format of the configuration parameter file is the following:

   <param name="name1" value="value1"/>
   <param name="name2" value="value2"/>


Set a group of configuration parameters using an XML file.
usage: bees config:update [options] CONFIG_FILE
 -a,--appid <arg>         CloudBees application ID
 -ac,--account <arg>      CloudBees account name

Example: Update the configuration parameters of application “test” with the test_param.xml file content. The previous parameters will be overwritten. (see list command above for XML syntax example)

bees config:update -a test test_param.xml


Delete configuration parameters.

usage: bees config:delete [options]
 -a,--appid <arg>         CloudBees application ID
 -ac,--account <arg>      CloudBees account name
 -g,--global               Global account parameters
 -f,--force               force delete without prompting

Example: Delete all configuration parameters of application “test” 

bees config:delete -a test


Set/define configuration parameters.

usage: bees config:set [options] [name=value]
 -a,--appid <arg>         CloudBees application ID
 -ac,--account <arg>    CloudBees account name
 -g,--global               Global account parameters
-P <name=value>         Application config parameter name=value
-R <name=value>         Runtime config parameter name=value

Note: By default a [name=value] parameter defined without option flag is equivalent to -P

Example: Add/set 2 configuration parameters to the  application “test” configuration

bees config:set -a test db.username=me db.password=”secure pass”
bees config:set -a test -P db.username=me -P db.password=”secure pass”

Example: Add/set a global configuration parameter 

bees config:set -g accessKey=key1


Unset/delete configuration parameters.

usage: bees config:unset [options] [name=value]
 -a,--appid <arg>         CloudBees application ID
 -g,--global               Global account parameters
 -ac,--account <arg>      CloudBees account name

Example: Delete configuration parameters mypassword and myusername from the application “test” configuration

bees config:unset -a test mypassword myusername

Using configuration parameters with other SDK commands

The commands for running and deploying your applications can also take advantage of your CloudBees configuration parameters.


Application/Environment configuration parameters can be overwritten for a specific deployment by specifying them on the command line (-P option) with the “bees app:deploy” command.

For example: If the configuration parameter “key” is defined for the application “test” (either globally at the account level or specifically for the application) it can overwritten for a specific deployment via the following command:

bees app:deploy -a test –P key=newValue

Multiple -P parameters can be specified
bees app:deploy -a test –P key=newValue -Pparam2=value2 ....

Created by Fabian Donze on 2012/03/09 19:55