Reputation: 95
I am integrating spring cloud config in one of the products, where spring cloud clients are configured to load properties from spring cloud config server, and spring cloud config server operates in two profiles namely native & vault.
Is there a way/possibility that the spring cloud config clients do NOT reach out to server when their "spring.active.profiles" is set to let's "local" And for any other profiles apart from "local" they reach out to server.
In short, clients pick properties from their local and not server's local when "spring.active.profiles" is "local" and for any other profile they reach out to server to load properties?
The reason is for local development, we won't require to have spring cloud config server up and running.
Cloud config server application.yml:
server:
port: 9111
spring:
profiles:
active: native
cloud:
config:
server:
# git:
# uri:
native:
searchLocations: classpath:/common
vault:
port: 8200
host: 127.0.0.1
kvVersion: 1
backend: kv
profileSeparator: /
management:
endpoints:
web:
exposure:
include: '*'
Cloud config client bootstrap.properties:
spring.application.name=config-client
spring.cloud.config.uri=http://localhost:9111
spring.cloud.config.token=<Token>
spring.profiles.active=local
Upvotes: 1
Views: 419
Reputation: 77
You can disable config server for a specific profile and refer to local property file. See below stackoverflow link for details:
Spring cloud config in local dev mode
Upvotes: 1