Unable to set Vault host in Spring Boot Config Server

106 views Asked by At

I have a Spring-Boot config server with a file system and Vault backend. I'm trying to point the Vault host to myvaultserver.com but I can't seem to use the uri property key so I always end up with a port but I don't want a port.

server:
  port: 8888
spring:
  main:
    banner-mode: off
  profiles:
    active: native, vault
  cloud:
    config:
      server:
        accept-empty: false
        native:
          order: 2
          searchLocations: "classpath:/, classpath:/{application}, classpath:/{application}/{profile}"
        vault:
          #uri: https://myvaultserver.com # what I wish I could do
          order: 1
          host: vault-os.app.ford.com
          port: 8200 # default
          scheme: https
          backend: secret
          default-key: application
          profileSeparator: /
          kvVersion: 2

Fetching that triggers the fail to connect to vault error:

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

My intent here is to fetch a clients config from the config server's local file system (confirmed to work) but also fetch the database username and password from Vault that will be used to form the database uri (a property on the local file system)

1

There are 1 answers

0
Arpit On

I think you should check the connection and access to the port where Vault is running from your application server. It could be that you don't have access from your application server to the Vault server on the port.

On a separate note, to override, you can try this from your code as well, to see if the configuration is a problem or maybe its an issue with access

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