Spring Boot 无法在Sping Boot Config Server中设置Vault主机

btqmn9zl  于 2023-11-17  发布在  Spring
关注(0)|答案(1)|浏览(159)

我有一个带有文件系统和Vault后端的Spring-Boot配置服务器。我试图将Vault主机指向myvaultserver.com,但我似乎无法使用uri属性键,所以我总是以端口结束,但我不想要端口。

  1. server:
  2. port: 8888
  3. spring:
  4. main:
  5. banner-mode: off
  6. profiles:
  7. active: native, vault
  8. cloud:
  9. config:
  10. server:
  11. accept-empty: false
  12. native:
  13. order: 2
  14. searchLocations: "classpath:/, classpath:/{application}, classpath:/{application}/{profile}"
  15. vault:
  16. #uri: https://myvaultserver.com # what I wish I could do
  17. order: 1
  18. host: vault-os.app.ford.com
  19. port: 8200 # default
  20. scheme: https
  21. backend: secret
  22. default-key: application
  23. profileSeparator: /
  24. kvVersion: 2

字符串
触发无法连接到Vault错误的获取:

  1. curl -X "GET" "localhost:8888/some-client-app/client-app-profile" -H "X-Config-Token: some_token_here"


这里我的目的是从配置服务器的本地文件系统获取客户端配置(确认可以工作),同时从Vault获取数据库用户名和密码,这些将用于形成数据库URI(本地文件系统上的属性)

m2xkgtsf

m2xkgtsf1#

我认为你应该检查连接和访问Vault从应用程序服务器运行的端口。这可能是因为你没有从应用程序服务器访问端口上的Vault服务器。
另外,要重写,您也可以从代码中尝试此操作,以查看配置是否有问题,或者是否存在访问问题

  1. VaultEndpoint endpoint = VaultEndpoint.from(new URI("https://vault-uri.com"));

字符串

相关问题