Many applications read settings from environment variables for configuring their behaviour. If your application needs to read environment variables the cf gem provides the following methods for managing the application's environment:
List current environment variables for an application
cf env <application-name>
Example: cf env my_app will display the current environment variables of the application called my_app within the current space.
Set an environment variable for an application
cf set-env <application-name> ENVIRONMENT_VARIABLE_NAME value
Example: cf set-env my_app CONFIG_DIRECTORY=config/ sets the CONFIG_DIRECTORY environment variable to the value config/ for the application called my_app within the current space.
Unset an environment variable for an application
cf unset-env <application-name> ENVIRONMENT_VARIABLE_NAME
Example: cf unset-env my_app CONFIG_DIRECTORY unsets the CONFIG_DIRECTORY environment variable for the application called my_app within the current space.
Your application will restart when setting or unsetting environment variables to ensure proper initialization with the customized environment.
Please sign in to leave a comment.