-
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
config_ordinal defined as property leaks into default properties #15221
Labels
Milestone
Comments
/cc @evanchooly |
/cc @radcortez |
I guess io.quarkus.deployment.configuration.BuildTimeConfigurationReader.ReadOperation line 382 is where the error happens. |
Spec discussion: eclipse/microprofile-config#676 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
If I have an application.properties file with an explicit priority config_ordinal=1000 it works well until I do a re-augmentation of the mutable-jar. It seems that during augmentation the config_ordinal value gets included in the default values which means that the priority of the default values all the sudden is the highest and they cannot be overwritten anymore. In my understanding the config_ordinal must be ignored when the current property values are included in the default properties.
We could work around it by defining a custom ConfigSource with ordinal = 1000 instead of setting the config_ordinal property. But that shouldn't be necessary.
I think it happens whenever a ConfigSource contains a config_ordinal value which is >= 100. One reason could be that you want a ConfigSource to have higher precedence than it usually would have. During augmentation the config_ordinal value is also included in the serialized default values and by that becomes the config_ordinal of the default value ConfigSource.
Expected behavior
If I set
config_ordinal
in a configuration file, it is only effective for the properties defined in that individual file.Actual behavior
If I set
config_ordinal
in any configuration file that is read during augmentation then it affects other configuration sources. This is because theconfig_ordinal
entry is afterwards also returned by the ConfigSourcePropertiesConfigSource[source=Specified default values]
To Reproduce
1. Checkout the reproducer project
2. Build and start Quarkus with an external config file (build/quarkus-app/config/application.yml)
3. The output shows the values of the config values:
display.unit.name
is set to "km/h" in the external config file. However becauseresources/application.properties
containsconfig_ordinal=1000
, all the properties defined in the project have the priority1000
.If you comment out
config_ordinal=1000
inresources/application.properties
and do a rebuild (reaugmentation would be sufficient) then you see thatdisplay.unit.name
is now correctly set to "km/h" but sinceconfig_ordinal=1000
is commented out, but it is now also possible to change the values defined inresources/application.properties
.fix.value
is now equal to "THIS_SHOULD_NOT_BE_VISIBLE".4. Manual Fix
2021-02-20 22:27:13,310 INFO [com.git.ren.con.StartupBean] (main) display.unit.name: km/h
2021-02-20 22:27:13,311 INFO [com.git.ren.con.StartupBean] (main) fix.value: THIS_MUST_HAVE_PRIORITY
Note:
This only works if the app was augmented without config_ordinal
Configuration
resources/application.properties
resources/application.yml
build/quarkus-app/config/application.yml
Environment (please complete the following information):
uname -a
orver
:java -version
:N/A
1.11.3.FINAL
mvnw --version
orgradlew --version
):Additional context
N/A
The text was updated successfully, but these errors were encountered: