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 PCF 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 either Pivotal Cloud Foundry (PCF) Apps Manager or the Cloud Foundry Command Line Interface (cf CLI).

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

To refresh a Config Server service instance’s Git mirrors using the cf CLI, you can use the cf update-service command. This command is given a -c flag with a JSON object containing parameters used to configure the service instance. The update-git-repos 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.

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.