-
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
Quarkus Mail + Env Variable + 0.23.1 #4245
Comments
No, it's a new problem, but working as designed: by specifying the environment variable as empty (rather than undefining it), you're explicitly saying that you want the value to be empty, which will cause a failure. Since you're expanding the property with no default, you're also causing the property to be undefined as well. So, first you need to change your config like this: quarkus.mailer.username=${MAIL_USER:}
quarkus.mailer.password=${MAIL_PASSWORD:} This says "if the property is empty or missing, expand to an empty string". Now, there is a good argument to say that when expanding a variable, empty values should expand into empty strings implicitly. However the problem is that the config infrastructure deliberately does not attempt to make a distinction between explicitly empty or empty-because-it-is-missing. Thus if we were to make such a change, it would mean that it would be impossible to cause a failure when a referenced property is not present. If this whole thing just stinks to you, another approach would be to remove these two properties and environment variables from your configuration, and instead use the "QUARKUS_MAILER_USERNAME" and "QUARKUS_MAILER_PASSWORD" environment variables directly. |
Thanks @dmlloyd for chiming in with a good explanation.
Indeed, this is a good alternative solution since mailer configurations can be overridden at runtime. |
So should this be closed as invalid (working as expected)? |
Sure, unless someone has a good argument that the current behavior is wrong. |
Agreed, I made the mailer this way actually. username and password are runtime as IMHO it's a runtime thing. |
Please reopen if you disagree with the invalidity. |
Agree, thanks for the explanation @dmlloyd ! |
Hi,
There is an issue that I'm facing after upgrade to 0.23.1 version, I don't face the issue when using 0.22.0.
Basically, if I have the code below, and the env variables are empty i.e
MAIL_USER=
, an error is thrown when using the native image.application.properties
log:
The text was updated successfully, but these errors were encountered: