-
Notifications
You must be signed in to change notification settings - Fork 180
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
Overriding a config property with hypen at runtime fails with an exception at startup #1264
Comments
Did it ou try with Quarkus 2? The new Config api let's us be a bit more precise. |
@cescoffier Yes. In fact, I found this bug while migrating from 1.11.6 to 2.0.0.CR3. I think it is broken since 1.13.5. |
Looking at it more deeply, seems to be something in Smallrye config. @radcortez did we change anything in config? |
I think (but @radcortez declined it :D), that it was introduced with smallrye/smallrye-config#563 |
Sounds related. |
I didn't decline it :) I've just said that I need to check on how the properties are being read, because the only thing we did there was to add a best effort equivalent to the This was mostly an easy fix for the Map problem, or else we would have to rewrite all the mapping logic around Anyway, let me have a look. |
@ahofmeister Check this out: Is this what you expect? I still have to look into the SR RM code, but I believe the main Config code is work as expected. |
I just stumbled across the same problem as well (although for another config property with hyphens in its name). I couldn't figure out where the wrong property names reported by |
@knutwannheden are you getting an error? or just a warning in the logs? |
Just warnings of the form |
It should be a false warning, which is fixed here: quarkusio/quarkus#17704 Can you confirm that the configuration is still being applied successfully? |
Thanks for the pointer. Yes, the configuration is correctly applied. |
@radcortez Thanks for the PR, good idea to include a test case! I think, the excpetion only occurs, IF the config ends up with So, no, that is not what I expect. I've added a custom test with another config property with the result I am expecting. I hope it's clear (I added a different case, because the applicaton will not fail on startup in this case) |
Thanks. Let me have a look. |
As I suspected, we suffer from the same issue we had with a corner case in For instance, if you only define an env variable, we cannot reach it because the logic around Lines 91 to 109 in 207b94a
That was the reason why I added a dotted version of the env key, so they could be found by logic like this. Of course, this doesn't play very well because you loose information from a regular key to an env key and then I think one possible solution is from the SR Config side to just add a dotted env version if we can't find the same dotted version in non env sources to provide the correct name, instead of blindly adding a dotted version for all the env keys. |
To clarify further, without the change in SR Config we can't set up configuration using |
I believe smallrye/smallrye-config#600 should do the trick. |
Doing the update right now. |
@cescoffier Is there any workaround available? As I mentioned, we are using Quarkus 2.0.0.Final and It uses still 3.5.0 instead of 3.6.0. Yes, we could rename the topic, but this would be a lot of work, because it's linked in many different locations. |
The fix is in config not in messaging.
…On Fri 2 Jul 2021 at 19:37, Alexander Hofmeister ***@***.***> wrote:
@cescoffier <https://github.com/cescoffier> Is there any workaround
available? As I mentioned, we are using Quarkus 2.0.0.Final and It uses
still 3.5.0 instead of 3.6.0.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1264 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADCG7LQNYDRJY5GEOY7JKTTVX2MVANCNFSM462EKSMA>
.
|
Thr SR Config version |
Try this: <dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-common</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
<version>2.4.1</version>
</dependency> |
@radcortez Thanks! It work's. :) |
And move config related test in the config package.
@radcortez Sorry for resurrecting an old issue but I'm running into exactly the same problem as the OP did, this time with Quarkus 3.12.2 and SR Config 3.8.3. That is, both hyphened (e.g., PropertyNamesConfigSourceInterceptor.java introduced in smallrye/smallrye-config#600 is no longer there (deleted in smallrye/smallrye-config#1000) and I haven't figured what happened with that logic yet. I'd like to ask: what is the current approach to converting environment variables to properties? Is the approach from smallrye/smallrye-config#600 (introduce a dotted property only if necessary) still valid? |
We had some major rewrites to improve the performance... maybe something was lost.
In the case of dynamic property names, we have no way of knowing if a separator is a dot or a dash, so a dotted property name is always required to disambiguate the case: https://quarkus.io/guides/config-reference#environment-variables |
Starting a Quarkus application with version 1.13.5.Final+ breaks the configuration of config keys with hyphens that are overriden with environment variables.
Example:
mp.messaging.incoming.keycloak-events.connector
andMP_MESSAGING_INCOMING_KEYCLOAK_EVENTS_CONNECTOR=smallrye-in-memory
I found out that in the end, the ConfigSource ends up with two properties.
smallrye-config/1.13.1/smallrye-config-1.13.1-sources.jar!/io/smallrye/config/EnvConfigSource.java
The problem is, that
MP_MESSAGING_INCOMING_KEYCLOAK_EVENTS_CONNECTOR
is converted tomp.messaging.incoming.keycloak.events.connector
, but in theapplication.properties
file the key ismp.messaging.incoming.keycloak-events.connector
. So the problem iskeycloak
vskeycloak-events
.I have added a reproducer: https://github.com/ahofmeister/mp-messaging-config-hyphen-reproducer
Please note: It works with Quarkus
1.11.6.Final
. (Also note, the reproducer will fail, because ofSRMSG00072: Unknown connector for
keycloak-events.
, which is fine in this case!)CC @radcortez
The text was updated successfully, but these errors were encountered: