Closed as not planned
Closed as not planned
Description
Apologies if this has been reported before, couldn't find any StackOverflow posts or GitHub issues.
When attempting to use spring.config.activate.on-cloud-platform
, there is no mechanism available to simply state "If not running on a cloud platform" without forcibly setting the NONE
value via spring.main.cloud-platform
through some other mechanism.
This is undesirable for libraries providing configuration files with default values (e.g. through multi-documents) for scenarios when the consumers is running on a cloud platform and for when they aren't, as it forces one of the following scenarios:
- Force consumers to specify
spring.main.cloud-platform: NONE
when running locally (ex: through their application-{local-env-name}.yml) - Abandon
spring.config.activate.on-cloud-platform
and multi-document config files, and conditionally load the properties through custom beans and manual CloudPlatform checks - Abandon
spring.config.activate.on-cloud-platform
and use a different, likely more unreliable, property condition, such asspring.config.activate.on-profile: 'DEV | LOCAL | NO-PLATFORM'
Proposed change:
private boolean isActive(CloudPlatform cloudPlatform) {
return this.onCloudPlatform == null
|| (this.onCloudPlatform == NONE && cloudPlatform == null)
|| this.onCloudPlatform == cloudPlatform);
}