11. 服务注册表配置

You can use a DiscoveryClient (such as from Spring Cloud Consul) to locate a Vault server by setting spring.cloud.vault.discovery.enabled=true (default false). The net result of that is that your apps need a application.yml (or an environment variable) with the appropriate discovery configuration. The benefit is that the Vault can change its co-ordinates, as long as the discovery service is a fixed point. The default service id is vault but you can change that on the client with spring.cloud.vault.discovery.serviceId.spring-doc.cadn.net.cn

The discovery client implementations all support some kind of metadata map (e.g. for Eureka we have eureka.instance.metadataMap). 一些额外的 service 属性可能需要在其服务注册的 metadata 中进行配置,以便客户端能够正确连接。 不提供传输层安全详细信息的服务注册需要在 metadata 中提供一个值为 scheme 的条目,将其设置为 https 或 http。 如果未配置方案且服务未作为安全服务暴露,则配置默认为 spring.cloud.vault.scheme,在未设置时为 https。spring-doc.cadn.net.cn

spring.cloud.vault.discovery:
    enabled: true
    service-id: my-vault-service