Skip to content

Commit

Permalink
Make the build time defaults a higher priority
Browse files Browse the repository at this point in the history
This means that if you set a value using a system property when building
the application it will now override the application.properties that is
packaged in the application (but not an external application.properties
on the file system).

Otherwise the behaviour is very confusing, with build time config values
only taking effect if they are not overriding a property in
application.properties.

Relates to (but does not fully fix) quarkusio#19438
  • Loading branch information
stuartwdouglas committed Aug 17, 2021
1 parent 278966b commit 72e2f77
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ public static final class GenerateOperation implements AutoCloseable {
// the build time config source field, to feed into the run time config
cc.getFieldCreator(C_BUILD_TIME_CONFIG_SOURCE)
.setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL);
//in-app application.yaml is 255, file-system application.properties is 260, this needs to be between them
//really it could be higher to stop build time config being overridden, but then the warning would not work
final ResultHandle buildTimeConfigSource = clinit.newInstance(PCS_NEW, buildTimeValues,
clinit.load("Build time config"), clinit.load(100));
clinit.load("Build time config"), clinit.load(256));
clinit.writeStaticField(C_BUILD_TIME_CONFIG_SOURCE, buildTimeConfigSource);

// the build time run time visible default values config source
Expand Down Expand Up @@ -567,7 +569,7 @@ public void run() {
}
}
final ResultHandle specifiedRunTimeSource = clinit.newInstance(PCS_NEW, specifiedRunTimeValues,
clinit.load("Specified default values"), clinit.load(Integer.MIN_VALUE + 100));
clinit.load("Specified default values"), clinit.load(256)); //in-app application.yaml is 255, file-system application.properties is 260, this needs to be between them
cc.getFieldCreator(C_SPECIFIED_RUN_TIME_CONFIG_SOURCE)
.setModifiers(Opcodes.ACC_STATIC | (devMode ? Opcodes.ACC_VOLATILE : Opcodes.ACC_FINAL));
clinit.writeStaticField(C_SPECIFIED_RUN_TIME_CONFIG_SOURCE, specifiedRunTimeSource);
Expand Down

0 comments on commit 72e2f77

Please sign in to comment.