大家都知道Spring Cloud Config统一配置中心默认支持GitHub。由于公司使用的是内部的GitLab来管理代码,因此配置还是有一点出入的。在这记录下来,方便有同样需求的小伙伴。
一、在后台项目的bootstrap.yml配置git地址:
spring:
profiles: local
cloud:
config:
server:
bootstrap: true
git:
uri: http://xx.xx.xx.xxx:xxxx/xxxx/hongguan-parent.git
username: GitLab用户名
password: GitLab密码
search-paths: hongguan-config/respo_conf
这里要注意几个点:
1.profiles这里,我的yml文件配置了local、dev、produce三个变量,因此需要在三个地方写;
2.Spring Cloud Config配置中心使用gitlab的话,要在仓库后面加后缀.git,而GitHub不需要。
二、使用https://natapp.cn/做内网穿透
使用教程:https://natapp.cn/article/natapp_newbie,在这里就不赘述了。