Search code examples
jsonibm-cloudcloud-foundry

Is there a way to import environment variables in cloud foundry application from a file


There is an option to set Environment variables in cloud foundry application in a runtime section. It also has an option to export these user defined variables to a JSON file. Is there a way to import them from a JSON file in bulk, or should i always create them manually one by one?


Solution

  • The Cloud Foundry CLI has commands cf set-running-environment-variable-group and cf set-staging-environment-variable-group which let you set the environment from a JSON file.

    http://cli.cloudfoundry.org/en-US/cf/set-running-environment-variable-group.html

    You could also script setting your environment variables by using the cf set-env command from the CLI.