Matt Berteaux
Matt Berteaux

Reputation: 763

Spring Boot handling region specific configuration

I know that you can have configuration profiles for dev, stage, prod, etc. I'm wondering how to handle configurations for different regions. In prod we might have 3 different regions, while in stage 2, and dev only 1. Some configuration properties might only have 1 value per environment. But some properties will have different values depending on the region. What is the best way to handle this? I don't particularly want to have an application.properties file per environment/region permutation.

Upvotes: 0

Views: 2822

Answers (1)

Stephane Nicoll
Stephane Nicoll

Reputation: 33091

So you can enable multiple profiles and have everything configured that way. You can also express more advanced criterion using profile expressions, there is a section with that exact use case in the documentation.

As of Spring Boot 2.1 you can define an expression on the active profiles so you could have something like this example.

Upvotes: 1

Related Questions