gpt4 book ai didi

spring-boot - 我的 Spring Boot 应用程序的/health 端点发出有关在同一台机器上运行的 Consul 服务器的所有信息。如何禁用此功能?

转载 作者:行者123 更新时间:2023-12-01 16:13:34 30 4
gpt4 key购买 nike

我启用了/health 端点,但我只是不希望它在同一台机器上列出 Consul 监控的所有服务。

这是我的 application.properties:

# Enable just the health endpoint.
endpoints.health.enabled=true

# Disable all default endpoints and Spring Cloud endpoints.
endpoints.enabled=false
endpoints.consul.enabled=false
endpoints.pause.enabled=false
endpoints.resume.enabled=false
endpoints.refresh.enabled=false
endpoints.restart.enabled=false
endpoints.shutdown.enabled=false
endpoints.env.enabled=false

management.health.db.enabled=false
management.health.diskspace.enabled=false
management.health.defaults.enabled=false

...这就是/health 当前发出的信息:
$ curl -o- http://localhost:8080/health | python -m json.tool
{
"consul": {
"advertiseAddress": "10.10.10.10",
"bindAddress": "10.10.10.10",
"clientAddress": "127.0.0.1",
"datacenter": "DC",
"domain": "consul.",
"nodeName": "mynode",
"services": {
"myservice1": [
"tag1"
],
"myservice2": [
"tag1",
"tag2"
]
},
"status": "UP"
},
"description": "Spring Cloud Consul Discovery Client",
"discoveryComposite": {
"description": "Spring Cloud Consul Discovery Client",
"discoveryClient": {
"description": "Spring Cloud Consul Discovery Client",
"services": [
"myservice1",
"myservice2"
],
"status": "UP"
},
"status": "UP"
},
"status": "UP"
}

我不介意 "description": "Spring Cloud Consul Discovery Client"但其余的东西在 "consul" 下和 "discoveryComposite"是我不想公开的东西 /health .

什么可以将这些信息添加到此端点?

最佳答案

它来自 Spring Cloud Commons。

禁用 discoveryComposite设置属性 spring.cloud.discovery.client.composite-indicator.enabled=false .

套装management.health.consul.enabled=false对于另一个。

关于spring-boot - 我的 Spring Boot 应用程序的/health 端点发出有关在同一台机器上运行的 Consul 服务器的所有信息。如何禁用此功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41613397/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com