-
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
How to configure empty string #671
Comments
The way to handle this is to use programmatic API: config.getOptionalValue() and then supply empty value with an empty string. |
Full empty conversation can be found here |
The problem is that an empty string differs in meaning from |
The use case provided by @tomas-langer looks legit. Using programmatic API is this case is a complicated workaround. |
@dmlloyd @radcortez can you explain in more details? In the meanwhile this issue documents some use case. |
The main motivation to move with these changes was to have a way to empty configuration values on higher ordinal sources and to have consistency between all types: #531 and #532. Using Finally, probably the easiest way is to use the new Does this help? |
No, not really @radcortez I had the following:
The password has three possible values - it does not exist (e.g. All of these options have an actual meaning
What you want me to do is to either
So I added an expression |
Hey @tomas-langer just to pick from our conversation this morning: In SR Config, I've implemented microprofile-config/api/src/main/java/org/eclipse/microprofile/config/ConfigValue.java Lines 41 to 46 in 562ece3
Anyway, this is separate from the entire empty / clear value discussion. |
I set
When I start dev mode, I get
|
Migrating from microprofie 2 to microprofile 5, I began receiving the "the config property ____ is defined as the empty string" error. I was under the impression that using a ConfigValue instead of a String, and then getting its value manually, would prevent this error when the property is not provided. I have not found a way to have a blank default without errors on startup. |
Empty value is not permitted unfortunately. See the lengthy conversation here. |
Description
I need to be able to configure an empty string as a configuration value.
Two use cases I have encountered so far:
I am only interested in a value if defined in configuration, otherwise I need an empty string. This used to work in previous version, now it fails validation.
What is the correct way to achieve this?
The text was updated successfully, but these errors were encountered: