With default add profile
You can enter your own environment variable in the application.properties file, next to specific profiles, using an expression. For example, if your current file looks like this:
spring.profiles.active=profile1,profile2
with a user environment variable, it will change to:
spring.profiles.active=profile1,profile2,${ADDITIONAL_APP_PROFILES:local}
where ADDITIONAL_APP_PROFILES is the name of the environment variable that you set instead of SPRING_PROFILES_ACTIVE .
The local value is used when the variable is not set in the current environment. In this case, a profile called local will be activated. If you do not specify a default value and there is no environment variable, the entire expression will be used as the name of the active profile.
No default add profile
If you like not to activate the default profile, you can remove the placeholder value and comma before the variable expression:
spring.profiles.active=profile1,profile2${ADDITIONAL_APP_PROFILES}
but in this case, the variable set in the current environment should begin with a comma:
export ADDITIONAL_APP_PROFILES=,local
source share