How do I fetch a properties file under a particular branch, per application, per profile, with Spring Cloud Config?

Viewed 181

I have the following setup:

myclientapp -> myspringcloudconfigserver -> myconfiggitrepo

I'm not using bootstrap.properties in myclientapp. Instead, I'm defining the following branch override in application-prod properties:

cloud.config.label = master

And in myspringcloudconfigserver application.properties, I have:

spring.cloud.config.server.git.default-label = dev

Then, under myconfiggitrepo, I have:

  • master branch: myclientapp-prod.properties with foo=masterbar
  • dev branch: myclientapp-prod.properties with foo=devbar

When I run the client (prod profile) and config server, and try to bind to foo in client, I'm getting devbar instead of masterbar, even though I explicitly specified cloud.config.label = master in the client.

1 Answers

I know of defaultLabel, not default-label

So try and use:

 spring.cloud.config.server.git.defaultLabel = dev

And if you want to be sure to avoid falling back to master:

spring.cloud.config.server.git.tryMasterBranch = false
Related