|
This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Cloud Config 5.0.5! |
Google Cloud Parameter Manager Backend
Spring Cloud Config Server can use Google Cloud Parameter Manager as an EnvironmentRepository.
Parameters are exposed as PropertySource entries whose values are obtained from the latest parameter versions.
Enabling the backend
The repository is registered when all of the following hold:
-
The Spring profile
parameter-manageris active. -
The
com.google.cloud:google-cloud-parameter-managerdependency is on the classpath.
spring:
profiles:
active: parameter-manager
cloud:
config:
server:
gcp-parameter-manager:
project-id: my-project
location: global
order: 0
application-label: application
profile-label: profile
default-label: main
Configuration properties are bound under spring.cloud.config.server.gcp-parameter-manager:
| Property | Default | Description |
|---|---|---|
|
Same as other environment repositories |
Order in a composite repository ( |
|
|
Parameter label key used to match the Config Server |
|
|
Parameter label key used to match the Config Server profile (see Mapping applications and profiles). |
|
|
Google Cloud Parameter Manager location. |
|
|
Label returned by the Config Server when the client does not provide a label. |
|
empty |
Google Cloud project ID containing the parameters. This property must be configured. |
Mapping applications and profiles
The repository lists the parameters in the configured Google Cloud project and location once for each Config Client request and filters the result according to the requested application and profiles.
Parameters are matched using their labels:
-
The label configured by
application-labelmust match the requested{application}name. -
The label configured by
profile-labelmust match the requested profile. -
Matching is case-insensitive.
-
If an application label is missing, it defaults to
application. -
If a profile label is missing, it defaults to
profile.
When a Config Client requests an application other than application, the application application is also included first. This allows shared configuration to be provided for all applications.
The configured Config Server default profile is also included before additional requested profiles when necessary.
For every matching parameter, the repository reads the latest version and adds its rendered payload as a property value. The property name is derived from the parameter name.
For example, a parameter with the name:
projects/my-project/locations/global/parameters/my-property
is exposed as:
my-property
Authentication
The Parameter Manager client is created using the Google Cloud client library’s default authentication mechanism. Configure Google Cloud credentials using Application Default Credentials.
This can include credentials provided through environment configuration, local development credentials, or Google Cloud runtime service accounts.