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.
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.
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.
This will bind an app and a db together:
In this case, the parameters and the end are customizing the connection pool settings (but are optional).
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.)
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.
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.
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).
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).
Here is some of the SDK commands to manage configuration parameters (you can run bees config to get help):
List configuration parameters.
Example: List configuration parameters of the application “test” and export them in the test_param.xml file
Delete configuration parameters.
Example: Delete all configuration parameters of application “test”
Set/define configuration parameters.
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
Example: Add/set a global configuration parameter
Unset/delete configuration parameters.
Example: Delete configuration parameters mypassword and myusername from the application “test” configuration
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:
Multiple -P parameters can be specified
bees app:deploy -a test –P key=newValue -Pparam2=value2 ....