Home:ALL Converter>Override configuration properties in micronaut

Override configuration properties in micronaut

Ask Time:2021-01-27T20:33:48         Author:Daniel Voina

Json Formatter

I have a micronaut application in which I want to override the default configuration properties based on a profile I pass through an environment variable. Tha application has a default application.yml I am currently passing:

MICRONAUT_CONFIG_FILES=classpath:application.yml,/path/to/application-prod.yml 
MICRONAUT_ENVIRONMENTS=prod

However just application-prod.yml is taken into account (unlike for Spring Boot where it updates the defaults).

What is the best way to achieve the update? The only solution so far is to replicate all the settings in application-prod.yml but it seems pretty anti-DRY.

Author:Daniel Voina,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65919277/override-configuration-properties-in-micronaut
yy