Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x: MP Config does not correctly handling per property overriding with config profiles #8738

Open
barchetta opened this issue May 9, 2024 · 1 comment · May be fixed by #8757
Open

4.x: MP Config does not correctly handling per property overriding with config profiles #8738

barchetta opened this issue May 9, 2024 · 1 comment · May be fixed by #8757
Assignees
Labels
4.x Version 4.x bug Something isn't working config microprofile P2
Projects
Milestone

Comments

@barchetta
Copy link
Member

barchetta commented May 9, 2024

Environment Details

  • Helidon Version: 4.0.8
  • Helidon MP

Problem Description

Helidon MP Config is not correctly handling per property overriding precedence when config profiles (spec) are used. Note that this is not a change from the MP Config 3.0 spec -- just a clarification.

The proper behavior is that a profile-specific property only overrides the vanilla property per config source. Therefore if I specify the vanilla property in a config source with a high ordinal, it should trump any profile specific property from a config source at a lower ordinal. Our implementation appears to always place a higher precedence on the profile-specific property. Looks like this is the problematic code:

return findConfigValue("%" + configProfile + "." + key)

return optionalValue("%" + configProfile + "." + propertyName, propertyType)

Steps to reproduce

You can run the MP Config 3.1 TCK. See #8724. Or

  1. Create the MP quickstart using the Helidon CLI
  2. Add this line to microprofile-config.properties: %dev.app.greeting=Yo
  3. Build then Run the application with java -Dmp.config.profile=dev -Dapp.greeting=Hola -jar target/quickstart-mp.jar
  4. Do curl -X GET http://localhost:8080/greet

You'll see the application returns the property from the dev profile which is incorrect:

{"message":"Yo World!"}

According to the spec (and the 3.1 TCKs) it should return the value from the system property (Hola) since that ConfigSource has a higher ordinal.

@github-actions github-actions bot added this to Triage in Backlog May 9, 2024
@barchetta barchetta changed the title 4.x: MP Config does not correctly handling per property overriding precedence with config profiles 4.x: MP Config does not correctly handling per property overriding with config profiles May 9, 2024
@barchetta barchetta added 4.x Version 4.x microprofile config bug Something isn't working labels May 9, 2024
@barchetta barchetta added this to the 4.1.0 milestone May 9, 2024
@barchetta
Copy link
Member Author

The fix to this issue might depend on #8737 getting fixed.

@barchetta barchetta self-assigned this May 14, 2024
@m0mus m0mus added the P2 label May 23, 2024
@m0mus m0mus moved this from Triage to Sprint Scope in Backlog May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x bug Something isn't working config microprofile P2
Projects
Backlog
  
Sprint Scope
Development

Successfully merging a pull request may close this issue.

2 participants