java为每个概要文件组配置spring云配置服务器
我几乎没有环境。有:
- 本地的
- 发展
- 试验
- 质量保证
- lod
- 刺激
如果config server连接到所有服务器,则所有内容都将清除
在我的情况下,我需要每个组的配置服务器:
- 在开发人员的控制下
- 在qa控制下
- 近devops控制
组连接到权限和不同的环境
因此,我需要为每个客户提供如下服务:
引导。yml
# default configs for local, dev, test profiles
spring:
application:
name: discovery-service
cloud:
config:
uri: http://local-dev-test-configuration-server:8888
---
# **bootstrap-qa.yml**
spring:
profiles: qa
application:
name: discovery-service
cloud:
config:
uri: http://qa-configuration-server:8888
---
# **bootstrap-prod.yml**
spring:
profiles: prod,lod
application:
name: discovery-service
cloud:
config:
uri: http://lod-prod-configuration-server:8888
在哪里
local-dev-test-configuration-server
将有权访问local
、dev
和test
服务器配置李>qa-configuration-server
将有权访问qa
配置李>lod-prod-configuration-server
将只能访问prod
和lod
配置李>
问题:
我研究了spring引导文档,但没有遇到过bootstrap.yml
评测
- 我应该遵循哪种方式来满足我的需求(管理3个不同的配置服务器和相应的配置文件)李>
- 我已检测到为同一配置服务器configure different git resources的能力。这种方法是否最适合我的情况(我还必须管理几个存储库以保持所需的配置)?我不这么认为。由于可见性不同,我需要为不同的环境配置几个配置服务器。因此,我需要根据配置文件对每个使用者配置主机名进行配置李>
# 1 楼答案
有两种可能的解决方案可以为spring云配置服务器配置客户端:
bootstrap.yml
中的配置文件,所以可以将所提供的配置用作解决方案bootstrap.yml
配置尽可能简单:在这种情况下,解决方案是使用
-Dspring.cloud.config.uri=http://localhost:8888
参数重写必需的属性,例如:附言
方法可以是混合的