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

Profile does not apply in helidon mp configuration made by meta-config.yaml #8851

Closed
ahreurink opened this issue Jun 6, 2024 · 3 comments
Closed

Comments

@ahreurink
Copy link

ahreurink commented Jun 6, 2024

Profiles in helidon-mp yaml configuration do not override config parameters.

Environment Details

  • Helidon Version: 4.0.9
  • Helidon MP
  • JDK version: openjdk 21 2023-09-19
  • OS: Ubuntu 22.04.4 (WSL)

Problem Description

When using a meta-config.yml file to specify a configuration file, this configuration file does not respect profiles. If I have a value

And i run my program with said profile, currently the value without profile is active, where as I expect the profile version to be active.

Steps to reproduce

Starting from a new helion-mp project, this is how I came to the described situation:

  1. Add a config parameter with profile to microprofile-config.properties:
    I added for example "%dev.app.greeting=Hello-dev" after the default line "example app.greeting=Hello".
    When compiling, and running java -Dmp.config.profile=dev -jar target/helidon-quickstart-mp.jar, now curl http://localhost:8080/greet returns the following: {"message":"Hello-dev World!"}

  2. Add the file meta-config.yaml with reference to the default configuration filemicroprofile-config.properties:

sources:
  - type: "classpath"
    properties:
      resource: "META-INF/microprofile-config.properties"

When I run mvn clean package, followed by java -Dmp.config.profile=dev -jar target/helidon-quickstart-mp.jar and finally curl http://localhost:8080/greet , I would expect the same response, but the response is {"message":"Hello World!"}

@ahreurink ahreurink changed the title Profile in helidon mp yaml configuration Profile does not apply in helidon mp configuration made by meta-config.yaml Jun 6, 2024
@ahreurink
Copy link
Author

The bug reproduces if I use mp-meta-config.yaml (I think this is how I should have done it to begin with).

However, if I use mp-meta-config.yaml and add add-default-sources: true, the expected behavior does occur, even if there is no microprofile-config.properties present

@tomas-langer
Copy link
Member

tomas-langer commented Jun 25, 2024

Meta-config yaml replaces other configuration options of MP Config.
You can configure profile in the meta-config.yaml file itself (and have a different file on each environment).

@ahreurink
Copy link
Author

Thank you for your response Thomas. I see I should have added system-properties as a source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants