CredHub Backend

Spring Cloud Config Server supports CredHub as a backend for configuration properties. You can enable this feature by adding a dependency to Spring CredHub.
pom.xml

org.springframework.credhub spring-credhub-starter

The following configuration uses mutual TLS to access a CredHub:

spring:
profiles:
active: credhub
cloud:
config:
server:
credhub:
url: https://credhub:8844

The properties should be stored as JSON, such as:

credhub set --name “/demo-app/default/master/toggles” --type=json
value: {“toggle.button”: “blue”, “toggle.link”: “red”}

credhub set --name “/demo-app/default/master/abs” --type=json
value: {“marketing.enabled”: true, “external.enabled”: false}

All client applications with the name spring.cloud.config.name=demo-app will have the following properties available to them:

{
toggle.button: “blue”,
toggle.link: “red”,
marketing.enabled: true,
external.enabled: false
}

When no profile is specified default will be used and when no label is specified master will be used as a default value. NOTE: Values added to application will be shared by all the applications. 
发布了0 篇原创文章 · 获赞 135 · 访问量 5251

猜你喜欢

转载自blog.csdn.net/blog_programb/article/details/105191405