2

There is a Java SpringBoot application, with an application.yaml file where all the properties are configured. some of the fields are configured to read from the deployment.yaml file st eince we use different environments, and the values for these fields changes. However I wan't to define a field which will consider the value from deployment.yaml file if it is present, else it should take the default value given.

Something like this:

root:
  some-sub-level:
    some-key: ${VALUE_FROM_DEPLOYMENT_YAML:${default.level.value}}

default:
  level:
    value: some-default-value

I tried several ways and couldn't succeed. It takes blank value since VALUE_FROM_DEPLOYMENT_YAML will be null in one particular environment.

PS: I'm aware of adding default value in Java code like with @Value("${value.from.application.yaml:"some default value"}, but I'm not interested in this. The requirement is not to read this in Java code but it will be a configuration for Azure Application Insight.

Could anyone help me what I'm missing here

Vinayaka S P
  • 177
  • 3
  • 13

1 Answers1

1

According to this answer, it supports this notation which is called Placeholder property:

spring: 
   profiles: 
     active: ${APP_PROFILE:test}
# ... #
testing_22
  • 2,340
  • 1
  • 12
  • 28