-
Notifications
You must be signed in to change notification settings - Fork 566
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
Yaml config profiles support #5159
Comments
Yea this can work, but by using "config.profile" system property will force the use of the Helidon SE Meta Configuration, which in turn will affect environment variable resolving and mutability. This will register only one source (MpHelidonConfigSource) instead of (MpSystemPropertiesSource, MpEnvironmentVariablesSource, YamlMpConfigSource) when config registration happens since it will no longer scan for discovered or default sources. |
Can you please review MP meta-config feature: https://helidon.io/docs/v3/#/mp/config/advanced-configuration#_creating_microprofile_config_sources_from_meta_config and see if that will meet your needs? |
@klustria yea, this can work as I mentioned above, it is not a problem of making it work using meta-config but more of having a consistent support across different config extensions(.properties, .yaml etc...). Also I think that by having the same system property "mp.config.profile" working using different types of configs will make use of the convention over configuration model, which I think is desired. I've made a PR that can bring this enhancement. |
The problem is that the config source implementation is MP spec based, and that does not have profile anywhere in the SPI. So we do not know which profile to use. The implementation of the PR you created is depending on a system property, which is not the only way to define a profile (it can be defined in another config source). So unless the SPI contains information about which profile to use, we cannot modify it. There might be a way to do this but it may be a little complex than what you PR presents but this may need to be looked at further by the team. In the meantime, your only workaround is to use meta-config. |
yea, I agree, the problem is the ConfigSourceProvider contract from the MP spec which doesn't provide a profile support, and indeed this doesn't cover the ConfigSource usecase, but I think the general usecase is to cover the system property use. Maybe using reflection to configure a profile field on the ConfigSourceProvider might be an option? |
@klustria updated the PR to use reflection to set the profiles property since the MP spec doesn't cover this, this should cover the configuration from other sources besides the system as well. |
Hello @botsteve, this is a limitation of MicroProfile specification and we cannot do much about it. |
This will be fixed by PR #5565 that will have a new SPI ( |
Closing as #5565 is merged. Will be working to port this into 3.x line. |
Environment Details
I have a question regarding the profile support for yaml config sources. I know there is profile support for microprofile-config-${profile}.properties files but does this support extends also to application-${profile}.yaml files?
I know that something like this can be done using mp-meta-config file and specify the profile property and an higher ordinal value for application-${profile} files, thus providing the same functionality as mp.config.profile system property.
I think that there should be a similar profile support for yaml files using the same system property as for the properties files.
If indeed there is no support for this and it is wanted, i can further pursue this.
The text was updated successfully, but these errors were encountered: