micronaut-projects / micronaut-discovery-client

Micronaut's Discovery Client
Apache License 2.0
20 stars 18 forks source link

Fix resolveEnvironment method to get proper envName from fileName #532

Closed atrzcinski closed 7 months ago

atrzcinski commented 10 months ago

With the existing code, the value of the envName variable will never be resolved correctly because the resolveEnvironment method will get the value of the fileName variable.

For example: if the name of the configuration file is my-service-prod.yaml (where prod is the name of the environment) and we provide fileName as a parameter (value is my-service-prod) instead of finalName (value is my-service[alpha]), then resolveEnvironment method will not be able to find environment.

The effect is that consul will overwrite the environment configuration with the standard configuration (e.g. my-service.yaml), i.e. the environment configuration will not be considered appropriate.

CLAassistant commented 10 months ago

CLA assistant check
All committers have signed the CLA.

atrzcinski commented 9 months ago

Sorry for delay with writing tests. I implemented second test with v2 suffix. It shows, that different application-specific file name affects the final effect, so order of propertySources are different. With this fix, the priority parameter of the propertySource will be valid, so sorting will always be deterministic.

atrzcinski commented 8 months ago

Hi,

@jeremyg484 When do you plan to merge this change?