简介git
Config Server:为了方便管理开发环境,测试环境,生产环境配置spring
1.建立Config Server新项目app
2.Config Server会从Git上拉取配置,咱们先去Git上新建个文件,注意建私有项目测试
拷贝以前eureka-client项目配置url
改完提交3d
3.Enabled的套路直接去启动文件先加上Enabled的启动配置code
4.修改项目配置文件server
spring: application: name: config cloud: config: server: git: uri: #文件git地址 username: #git用户名 password: #git密码 eureka: client: service-url: defaultZone: http://localhost:8001/eureka/ server: port: 8082
5.启动项目测试blog
访问路径的命名规则:开发
1./{name}-{profiles}.yml
2./{label}/{name}-{profiles}.yml
name 服务名
profiles 环境
label 分支(若是不加默认使用master分支)
再master新搞个文件测试哈第1种规则
访问http://localhost:8082/customer-dev.yml
经过这个咱们就能够把各个环境的配置进行隔离
再新搞个分支测试哈第2种规则
访问http://localhost:8082/release/customer-dev.yml