The Config Server

The Config Server serves configurations stored as either Java Properties files or YAML files. It reads files from a Git repository (a configuration source). Given the URI of a configuration source, the server will clone the repository and make its configurations available to client applications in JSON as a series of propertySources.

Configuration Sources

A configuration source contains one or more configuration files used by one or more applications. Each file applies to an application and can optionally apply to a specific profile and / or label.

The following is the structure of a Git repository which could be used as a configuration source.

master
------
https://github.com/myorg/configurations
|- myapp.yml
|- myapp-development.yml
|- myapp-production.yml

tag v1.0.0
----------
https://github.com/myorg/configurations
|- myapp.yml
|- myapp-development.yml
|- myapp-production.yml

In this example, the configuration source defines configurations for the myapp application. The Server will serve different properties for myapp depending on the values of {profile} and {label} in the request path. If the {profile} is neither development nor production, the server will return the properties in myapp.yml, or if the {profile} is production, the server will return the properties in both myapp-production.yml and myapp.yml.

{label} can be a Git commit hash as well as a tag or branch name. If the request contains a {label} of (e.g.) v1.0.0, the Server will serve properties from the v1.0.0 tag. If the request does not contain a {label}, the Server will serve properties from the default label. For Git repositories, the default label is master. You can reconfigure the default label (see the Configuring with Git topic).

Request Paths

Configuration requests use one of the following path formats:

/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties

A path includes an application, a profile, and optionally a label.

  • Application: The name of the application. In a Spring application, this will be derived from spring.application.name or spring.cloud.config.name.

  • Profile: The name of a profile, or a comma-separated list of profile names. The Config Server’s concept of a “profile” corresponds directly to that of the Spring Profile.

  • Label: The name of a version marker in the configuration source (the repository). This might be a branch name, a tag name, or a Git commit hash. The value given to the Config Server as a default label (the setting of git.label; see the table of the Config Server’s general configuration parameters) can be overridden in a client application by setting the spring.cloud.config.label property.

For information about using a Cloud Foundry application as a Config Server client, see the Configuration Clients topic.

Create a pull request or raise an issue on the source for this page in GitHub