spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.08k stars 40.67k forks source link

Allow Specifying ConfigData.Options On ConfigDataEnvironmentContributors #42932

Open ryanjbaxter opened 2 days ago

ryanjbaxter commented 2 days ago

As part of the Spring Cloud Config Server we utilize Spring Boot's ConfigDataEnvironmentPostProcessor to populate an Environment with PropertySources from various environment repositories that utilize the file system (Git, SVN, native).

You can see how we use it here.

We would like the ability to customize the ConfigData.Options that are set on the ConfigDataEnvironmentContributors the PostProcessor creates. Specifically for our use case we would like to basically tell the environment to ignore any profiles that it might find included or activated by adding ConfigData.Options.IGNORE_PROFILES.

This would allow the Spring Cloud Config client to make a request to the config server to return only the non-profile-specific property sources allowing Spring Boot to then activate all the profiles from all config data sources and then make a subsequent request to the config server to then get all profile specific property sources. Currently with no way to do this the config server will return profile specific property sources if any of the configuration files in the environment repository includes spring.profiles.active or spring.profiles.include.

philwebb commented 1 day ago

Putting in 3.x, but this could be a 4.0.x issue.