Skip to content

Commit

Permalink
Merge pull request #30604 from radcortez/fix-30543
Browse files Browse the repository at this point in the history
Remove lookup by profile when updating configurations
  • Loading branch information
radcortez authored Jan 27, 2023
2 parents a5d2628 + ce0e690 commit 3f91b7d
Showing 1 changed file with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkus.vertx.http.deployment.devmode.console;

import static io.quarkus.runtime.LaunchMode.DEVELOPMENT;

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -46,7 +44,6 @@
import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler;
import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem;
import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.quarkus.vertx.http.runtime.devmode.ConfigDescription;
import io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsManager;
import io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsRecorder;
Expand Down Expand Up @@ -215,25 +212,18 @@ static void updateConfig(Map<String, String> values) {
if (values != null && !values.isEmpty()) {
try {
Path configPath = getConfigPath();
List<String> profiles = ConfigUtils.getProfiles();
List<String> lines = Files.readAllLines(configPath);
for (Map.Entry<String, String> entry : values.entrySet()) {
String name = entry.getKey();
String value = entry.getValue();
int nameLine = -1;
for (int i = 0, linesSize = lines.size(); i < linesSize; i++) {
String line = lines.get(i);
for (String profile : profiles) {
String profileName = !profile.equals(DEVELOPMENT.getDefaultProfile()) ? "%" + profile + "." + name
: name;
if (line.startsWith(profileName + "=")) {
name = profileName;
nameLine = i;
break;
}
if (line.startsWith(name + "=")) {
nameLine = i;
break;
}
}

if (nameLine != -1) {
if (value.isEmpty()) {
lines.remove(nameLine);
Expand Down

0 comments on commit 3f91b7d

Please sign in to comment.