-
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
Kafka security config params not being picked up from env file #9947
Comments
Unfortunately this is a consequence of the Kafka config not being part of the regular Quarkus config system (@dmlloyd was soooooooooooo right when he insisted that all configuration go through the Quarkus config system - unfortunately not every extension headed his suggestion) |
Aah that makes kinda sense, thanks. Is there an easy way to fix this in the extensions? Or plans to enforce this in the future in Quarkus? |
It's mainly useful for during development/debugging when you want to connect and switch locally to another Kafka broker. For production we use env vars anyway for the secrets. |
It's not a strict rules, so it's really up to each extension. |
Alright thanks for the background info and suggestion, just posted it to the mailing list too. |
Wouldn't it make sense to just send a pull request to add the properties you need? Are you using io.quarkus:quarkus-kafka-client or io.quarkus:quarkus-smallrye-reactive-messaging-kafka ? I am not familiar with the |
@emmanuelbernard the The issue here is that because the kafka config is not part of the Quarkus config (it reads properties manually), it doesn't pick up the DotEnvConfigSource. |
Yeah indeed, the weird thing for me here is that YAML, env vars, application properties all work, except for the We override the security config for connecting to the prod broker for debugging for example. And during local development we don't want to deal with a SASL set-up etc and simply use a docker-compose with kafka and zookeeper. For me it would be nice from a usability point for Quarkus users that all configuration works the same, regardless of the extension. That's just my take on it though. I'm happy to help on adding this to the extions, just don't know where to start 😄 |
Using |
Let's see what @cescoffier has to say before proceeding any further |
And thanks for let me know. I did look at the kafka client code and what you reported was not making sense. I'm happy it was not my brain disagreeing with reality. |
@cescoffier would you welcome a PR to fix this? |
I need to check., but I believe it's already fixed by smallrye/smallrye-reactive-messaging#801. |
Describe the bug
Not all Kafka security options are being picked up when using a
.env
file. We need this as we use SASL authentication. Other parameters do work as expected when provided in a.env
file.Expected behavior
Quarkus picks up all parameters from a
.env
file.Actual behavior
The following parameters work as expected in a property file, yaml config and environment variable, hower they do not work when specified in a
.env
file:KAFKA_SECURITY_PROTOCOL=SASL_SSL
KAFKA_SASL_MECHANISM=PLAIN
KAFKA_SASL_JAAS_CONFIG=<config>
Example of parameters that do work with a
.env
file:KAFKA_BOOTSTRAP_SERVERS=<host>
KAFKA_REQUEST_TIMEOUT_MS=60000
To Reproduce
Steps to reproduce the behavior:
.env
filesConfiguration
application.yaml
-> works as expected.env
-> doesn't work for security and sasl parametersManually exporting those environment variables -> does work
Screenshots
Security parameters from
.env
file are not picked up:After manually exporting it does work:
Environment (please complete the following information):
uname -a
orver
:java -version
:N/A
1.5.0.Final
mvnw --version
orgradlew --version
):Additional context
Let me know if you need more information or examples.
The text was updated successfully, but these errors were encountered: