-
Notifications
You must be signed in to change notification settings - Fork 115
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
Allow to fetch multiple config parameters as a Map #562
Comments
What's your usecase, @rmanibus ? This looks like a useful feature for end users but you indicated that you're raising this as a SPI user and specification implementer. I don't think that implementers or SPI users really need this, do they? In which situations? |
Sorry I missclicked this. Fixed |
I am not sure what you are trying to achieve by putting the config values with the same type in a map. What is your use case? |
I have a config that look like:
I think it would be easier to use this config like:
|
I think that with 240 we still miss the ability to fetch a config parameter with a key that depends on a runtime value. However regarding an enum:
We could use:
When I need to fetch a configuration with a key that is not known in advance (but that must be contained in the enum), we could just fetch it with:
And we can ensure that a configuration value exist for every value in the enum. |
When we need a dynamic configuration, it can be very helpful to use a map. For example, let's say that I want to keep in my configuration the custom reason phrases to return to the enduser according to the http status code. I would like to have: The expected code
The expected configuration
Do you believe that it is a feature that can be considered in the near future? |
In SR Config we support maps like this: https://smallrye.io/docs/smallrye-config/main/mapping/mapping.html#_collections_config_mapping. At the spec level, maybe we could add the support for it as well. |
@radcortez Hi, yes I'm aware of it, I already tested it, it works well. However, I'm currently migrating several projects from Dropwizard to Quarkus, and using it, needs a lot of changes in the current code because the configuration classes are (unfortunately) field based so it is simpler to rely on the annotations |
Well, maybe I can implement that in SR Config side. No new API requires (or changes), but of course it probably won't work in other implementations. |
I think in this scenario, basically add the support of Map<String, Object>. |
@radcortez Good news! thx for that. If you are open to contributions, I could try to propose a PR for that in SR/Quarkus if you want
@Emily-Jiang thx for your proposal, it could be great too, please let me know if I can help in any ways to move this topic forward |
I think we can work on this issue after jakarta namespace alignment was done, which could be done soon hopefully. |
@essobedo sure. please go ahead. you can do it in SR Config. |
Hey, is there any news on it? I requested something similar to Jakarta Config: |
It is unlikely that this will be added to MP Config, since most of the effort is in Jakarta Config (which will take a while). Anyway, if anyone in the community wants to work on it, I'm happy to review it. |
@radcortez I would be happy to work on it. |
Yes, spec and TCK. |
@rmanibus can you please provide a PR to address this issue? |
Description
As a:
...I need to be able to:
fetch multiple configuration parameters with same type as a Map
or fetch multiple configuration parameters with different type as a scoped Config
...which enables me to:
Avoid the more generic
The text was updated successfully, but these errors were encountered: