Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default value for application.properties (profile) environment placeholder cannot be comma separated

I have the following property in my application.properties.

spring.profiles.active=dev,local

This works fine. However, I decided to also expose this as an environment variable and keep dev,local as the default values. However the following does not work.

spring.profiles.active=${PROFILES_ACTIVE:dev,local}

It seems comma causes this issue.

Checking the logs

[2018-05-24 05:38:28.163] [main] [INFO] [Application] The following profiles are active: ${PROFILES_ACTIVE:dev,local}

However, the following works.

spring.profiles.active=${PROFILES_ACTIVE:dev}

Any suggestions on how go about this?

like image 968
Chad Avatar asked May 24 '18 05:05

Chad


1 Answers

Try:

spring.profiles.active=${PROFILES_ACTIVE:#{'dev,local'}}

It uses the EL syntax with templating.

like image 55
Plamen Avatar answered Sep 30 '22 15:09

Plamen