Skip to content

Commit

Permalink
Disable expressions when getting datasource properties for restart
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Jul 18, 2024
1 parent 6a7e471 commit a05f569
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import org.eclipse.microprofile.config.ConfigProvider;
Expand Down Expand Up @@ -42,6 +42,7 @@
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.smallrye.config.Expressions;
import io.smallrye.config.SmallRyeConfig;

@BuildSteps(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
Expand Down Expand Up @@ -202,18 +203,14 @@ public void run() {
* If a property ends with {@code .} then it will also trigger a restart on any sub properties change
*/
private static Map<String, String> getRestartTriggeringPropertiesValues() {
Map<String, String> datasourceProperties;
try {
datasourceProperties = ConfigProvider.getConfig()
.unwrap(SmallRyeConfig.class)
.getOptionalValues("quarkus.datasource",
String.class,
String.class)
.orElse(Map.of());
} catch (NoSuchElementException e) {
log.error("Could not get datasource properties", e);
datasourceProperties = Map.of();
}
Map<String, String> datasourceProperties = Expressions.withoutExpansion(new Supplier<Map<String, String>>() {
@Override
public Map<String, String> get() {
return ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).getValues("quarkus.datasource", String.class,
String.class);
}
});

Map<String, String> filteredProperties = new HashMap<>();
for (var entry : datasourceProperties.entrySet()) {
if (!EXCLUDED_RESTART_PROPERTIES.contains(entry.getKey())) {
Expand Down

0 comments on commit a05f569

Please sign in to comment.