Using Configurations from Configuration Management Services for Cloud Foundry
#
<property name>#
in the application properties, where
<property name>
is the name of the configuration parameter.
For example,
#RESPONSE_MESSAGE#
.
The environment variable
APP_CONFIG_PROFILE
can be used to identify the profile name for your deployment environment, for example
QA
or
Prod
. For more information, see
Environment Variables for Cloud Foundry.
Integrating with Spring Cloud Config Server
Support for application configuration is provided through integration with the Spring Cloud Config Server.
You first create an instance of the service using the VMware Tanzu Apps Manager and then bind this service instance to your application.
Using Custom User Provided Services (CUPS) for Config Servers
The following are required when integrate your application with custom user provided services (CUPS) Spring Cloud Config or ZUUL Configuration service in Cloud Foundry:
- Name of the Cloud Foundry service instance must contain either
spring-cloud-config
orzuul-config
. - The service configuration must contain the
uri
parameter.For example, for ZUUL
{ "credentials": { "uri": "http://{ZUUL-SERVER-IP}:{PORT}/zuul" }, "label":"user-provided", "name": "zuul-config-server", "syslog_drain_url": "", "tags": [] }
For Spring Cloud
{ "credentials": { "uri": "http://{SPRING-CLOUD-SERVER-IP}:{PORT}" }, "label":"user-provided", "name": "spring-cloud-config-server", "syslog_drain_url": "", "tags": [] }
The environment variable
APP_CONFIG_PROFILE
can be used to set
ProfileName
. If this variable is not set,
default
name is used for the profile.
The environment variable
SPRING_CLOUD_CONFIG_VAULT_TOKEN
can be used to pass the Vault token for VMware Tanzu application, while using Vault as back end for Spring Cloud Config.
- getKeysForConfig()- This method returns the list of all the tokens that are required to fetch from the config management server.
- replaceProfileValues()- This method replaces values of the corresponding keys, fetched from the users, in the pcf.substvar file.