![](/img/trans.png)
[英]Include common config for multiple apps in Spring Cloud Config server
[英]Spring Cloud Config Server fallback for multiple repositories
我们正在使用由 bitbucket 支持的 spring 云配置服务器作为配置文件。 我们在配置服务器的 application.yml 中配置了多个存储库。 即使 bitbucket 关闭,我们也希望它可用。 我们正在寻找一种可以缓存配置存储库的解决方案,如果 bitbucket 出现故障,它仍然可以提供不同存储库的属性。 下面是我的 application.yml
spring:
cloud:
config:
server:
git:
uri: git@bitbucket.org:config1.git
ignoreLocalSshSettings: true
privateKey: ${PEM}
repos:
service1:
uri: git@bitbucket.org:config2.git
ignoreLocalSshSettings: true
privateKey: ${PEM}
service2:
uri: git@bitbucket.org:config3.git
ignoreLocalSshSettings: true
privateKey: ${PEM}
我尝试设置spring.cloud.config.server.git.basedir
但它只克隆基本配置仓库。 如果 bitbucket 关闭,我们如何使配置服务器从本地服务。
使用basedir
属性是唯一的出路。 这就是我们如何使用它:
spring:
cloud:
config:
server:
git:
uri: git@bitbucket.org:config1.git
ignoreLocalSshSettings: true
privateKey: ${PEM}
basedir: /home/user/config1-repo
repos:
service1:
uri: git@bitbucket.org:config2.git
ignoreLocalSshSettings: true
privateKey: ${PEM}
basedir: /home/user/config2-repo
service2:
uri: git@bitbucket.org:config3.git
ignoreLocalSshSettings: true
privateKey: ${PEM}
basedir: /home/user/config3-repo
您如何尝试重现 git 不可用并强制配置服务器从本地服务器路径获取属性的场景。 我建议你创建本地路径。 并使用 git-bash 克隆本地 repo 目录中的配置 repo。 例如,在这种情况下 go 在/home/user/localRepo
并在那里克隆您的配置 git 存储库。 确保正确克隆所有文件和文件夹。
然后尝试重现 git 不可用场景并检查您的配置服务器 MS 是否能够从本地目录获取属性。 这是回退的唯一出路。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.