健康指标
Config Server 自带一个健康指示器(Health Indicator),用于检查配置的 EnvironmentRepository
是否正常工作。默认情况下,它会向 EnvironmentRepository
请求一个名为 app
的应用程序、default
配置文件,以及由 EnvironmentRepository
实现提供的默认标签。
你可以配置 Health Indicator 来检查更多的应用程序,包括自定义配置文件(custom profiles)和自定义标签(custom labels),如下例所示:
spring:
cloud:
config:
server:
health:
repositories:
myservice:
label: mylabel
myservice-dev:
name: myservice
profiles: development
你可以通过设置 management.health.config.enabled=false
来禁用健康指示器。
此外,您可以通过设置属性 spring.cloud.config.server.health.down-health-status
来提供自定义的 down
状态(默认值为 "DOWN"
)。