SVN配置仓库
示例见:http://lvdccyb.iteye.com/blog/2282407
本地仓库
本地文件系统
使用本地加载配置文件。
需要配置:spring.cloud.config.server.native.searchLocations
跟spring.profiles.active=native
。
路径配置格式:classpath:/, classpath:/config,file:./, file:./config
。
健康检查
Spring Cloud Config的服务端为spring-boot-actuator模块的/health端点实现了对应的健康检测器:ConfigServerHealthIndicator
测试一把,将uri故意写错,
访问/health看结果:
通过这个指示器能够检查已经配置的EnvironmentRepository
是否正常运行。
通过设置spring.cloud.config.server.health.enabled=false
参数来禁用健康指示器。
属性覆盖
“spring.cloud.config.server.overrides”添加一个Map类型的name-value对来实现覆盖。
例如
spring:
cloud: config: server: overrides: foo: bar
会使所有的配置客户端应用程序读取foo=bar到他们自己配置参数中。
3.2.3 安全
你可以自由选择任何你觉得合理的方式来保护你的Config Server(从物理网络安全到OAuth2 令牌),同时使用Spring Security和Spring Boot 能使你做更多其他有用的事情。
为了使用默认的Spring Boot HTTP Basic 安全,只需要把Spring Security 增加到classpath中(如org.springframework.boot.spring-boot-starter-security)。默认的用户名是“user”,对应的会生成一个随机密码,这种情况在实际使用中并没有意义,一般建议配置一个密码(通过 security.user.password属性进行配置)并对这个密码进行加密。
3.2.4 加密与解密
如果远程属性包含加密内容(以{cipher}开头),这些值将在通过HTTP传递到客户端之前被解密。
使用略
3.2.5 密钥管理
配置服务可以使用对称(共享)密钥或者非对称密钥(RSA密钥对)。
使用略
3.2.6 创建一个测试密钥库
3.2.7 使用多密钥和循环密钥
3.2.8 加密属性服务
3.3 可替换格式服务
配置文件可加后缀".yml"、".yaml"、".properties"
3.4 文本解释服务
/{name}/{profile}/{label}/{path}
3.5 嵌入配置服务器
一般配置服务运行在单独的应用里面,只要使用注解@EnableConfigServer
即可嵌入到其他应用。
3.6 推送通知和总线
添加依赖spring-cloud-config-monitor
,激活Spring Cloud 总线,/monitor
端点即可用。
当webhook激活,针对应用程序可能已经变化了的,配置服务端将发送一个RefreshRemoteApplicationEvent
。