Refreshing Configuration Properties

Page last updated:

When you make a change to a configuration property stored in a Git repository, you may need to update both the mirror used by the Config Server and the client application’s local configuration. See below for information about refreshing configuration properties served by a Config Server service instance.

Config Server Architecture

The Config Server serves properties from multiple sources, including one or more Git repositories. For Git repositories, the Config Server makes use of an internal “mirror service” to create a mirror of each Git repository used. These mirrors are local to the VMware Tanzu Application Service for VMs (TAS) foundation, and the Config Server serves properties to client applications from these mirrors, rather than from the external Git repositories themselves.

Config server refresh

Refreshing Git Mirrors

You can manually refresh a Config Server service instance’s Git mirrors using Apps Manager, the Cloud Foundry Command Line Interface (cf CLI), or a custom Spring Boot Actuator endpoint on the service instance’s backing app.

Using the Dashboard

Note: The Synchronize Mirrors button is available only in Spring Cloud Services v3.0.3 and later.

To refresh a Config Server service instance’s Git mirrors using the dashboard, locate the service instance’s dashboard as described in Using the Dashboard.

Synchronize mirrors button

Below the Configuration section, click Synchronize Mirrors. When the mirror has been updated, the dashboard will display the message “Mirror refresh complete.”

Using the cf CLI

Note: To use the Spring Cloud Services cf CLI plugin to refresh Git mirrors for a service instance, you must have either the Space Developer role in the service instance’s space, or the Admin role.

To refresh a Config Server service instance’s Git mirrors using the cf CLI, you can use the cf config-server-sync-mirrors command added by the Spring Cloud Services plugin for the cf CLI (see Cloud Foundry CLI Plugin). For example, to refresh the Git mirrors for a Config Server service instance named my-config-server, you would run:

$ cf config-server-sync-mirrors my-config-server

You can also use the cf update-service command to refresh Git mirrors for a service instance, by passing an update-git-repos parameter to the command. This parameter forces the Config Server mirror service to pull all upstream Git repositories used by a Config Server service instance.

To update all mirrors used by a Config Server service instance, run cf update-service SERVICE_NAME -c '{ "update-git-repos": true }', as in the following example:

$ cf update-service my-config-server -c '{"update-git-repos": true }'

When the mirror has been updated, the cf service SERVICE_NAME command will give a status of update succeeded.

Using the Actuator Endpoint

Note: To use this method of refreshing Git mirrors for a service instance, you must have either the Space Developer role in the service instance’s space, or the Admin role.

Each Config Server service instance has a custom Spring Boot Actuator endpoint available at /actuator/refreshmirrors. You can use this endpoint to refresh a Config Server service instance’s Git mirrors.

After locating the service instance URL, append the path /actuator/refreshmirrors to that URL. Then make an authenticated HTTP POST request. If you have logged in using the cf CLI, you can use the cf oauth-token command to provide the OAuth 2.0 token for use in your request:

$ curl -X POST -H "Authorization: $(cf oauth-token)" -H "Content-Type: application/json" https://config-server-a5782192-8036-4f57-8312-4756a2604240.apps.example.com/actuator/refreshmirrors

Refreshing a Client App

In a Spring client app, you can use RefreshScope to allow for refreshing of Spring beans which use configuration served by the Config Server. For more information, see the Refresh Client Application Configuration section of Writing Client Applications.