-
Notifications
You must be signed in to change notification settings - Fork 110
Add, Update, or Remove Environment Variables using Task
tmpayton edited this page Apr 3, 2025
·
10 revisions
This wiki will show you how to use the remove_env_var
and add_update_env_var
task to modify environment variables.
Note: This task can only be run locally
cf login -a api.fr.cloud.gov --sso
cf env <app> > old_env_var.json
export SLACK_HOOK=<XXXX>
To add or update an environment variable:
python cli.py add_update_env_var <space> <service instance> <key> <value>
To remove an environment variable:
python cli.py remove_env_var <space> <service instance> <key to remove>
cf env <app>
rm old_env_var.json
These tasks requires that you pass in the space
and service instance
.
-
space
: [Required] the space that you want to update -
service_instance
: [Required] the user provided service you want to update
For adding or updating environment variables you must pass in the key value pair:
-
key
: [Required] The key of the environment variable you would like to add or update -
value
: [Required] The value of the environment variable you would like to add or update
For removing an environment variable you must also pass in the key to remove:
-
key_to_remove
: [Required] The key of the environment variable you would like to remove
python cli.py add_update_env_var dev fec-service-instance example_key 1234
python cli.py remove_env_var dev fec-service-instance example_key