-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ConfigMapping interface containing nested Map not being initialized properly if using VaultConfigSource #38869
Comments
/cc @radcortez |
Hi @wiebeck @vsevel, is it a duplicate of quarkiverse/quarkus-vault#231 ? |
No, this is something different. |
This issue is due to the more thorough validation of properties containing dashes ("-") usually passed as environment variables since Quarkus 3.7. Workaround is to use |
This is caused by the Consider: @ConfigMapping(prefix = "acme")
interface MyConfig {
String value();
Map<String, String> map();
} When populating the To populate a Ideally, all sources should implement In such cases, you can provide the empty names in source with a lower ordinal (like |
@radcortez Thanks for the explanation. This actually makes sense (btw. debugging smallrye-config is HELL!). I cannot provide the property names in |
Yes, Env vars or system properties work, too.
Sorry about that. There was a lot of generated code before (there still is), but I did a major rewrite of the mappings implementation and everything should be abstracted now and easier to debug. The generated code is mainly calling the And you can even simulate the generated code: |
Describe the bug
Assume you have a config interface like this:
When specifying a config like this:
I should get an
innerConfigs
map of size 3 containing the valuesd
,e
andf
.This works as expected if the config comes from e.g. a local properties file. It does not work as expected if the config comes from e.g. Vault provided by a
VaultConfigSource
.Expected behavior
I assume that it should not matter what the source of the properties is and still get a fully populated
MyConfig
class offering access to all three instances ofInnerConfig
.Actual behavior
When using Vault as config source the
innerConfigs
map is empty although I can still access the properties viaSo they can be read successfully from Vault. It's just the mapping to the
Map<String, InnerConfig>
that seems to fail.How to Reproduce?
I have a reproducer ready at https://github.com/wiebeck/quarkus-configmap-issue with more details.
Output of
uname -a
orver
Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
Output of
java -version
openjdk version "21.0.1" 2023-10-17 LTS OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
Quarkus version or git rev
3.7.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.5
Additional information
The environment shouldn't matter since we encoutered the issue in an app running on Kubernetes in a Linux container.
The text was updated successfully, but these errors were encountered: