PY-yaml library doesn't resolve environment variables by default. You need to define an implicit resolver that will find the regex that defines an environment variable and execute a function to resolve it. You can do it through yaml.
YAML is a data serialization language that is often used for writing configuration files. So YAML configuration file in Spring Boot provides a very convenient syntax for storing logging configurations in a hierarchical format. The application.
Now, when your Spring Boot application starts, it will be given those environment variables, which will override your application. properties .
As well as Java properties files, we can also use YAML-based configuration files in our Spring Boot application. YAML is a convenient format for specifying hierarchical configuration data. This can be more readable than its property file alternative since it does not contain repeated prefixes.
Try ${OPENSHIFT_DIY_PORT}
(the usual Spring placeholder notation). See here for docs.
You even can add default value, if environment variable not provided:
logging:
level:
root: ${LOGGING_LEVEL_ROOT:info}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With