Skip to content

Commit

Permalink
Fix config sources
Browse files Browse the repository at this point in the history
Signed-off-by: Václav Muzikář <[email protected]>
  • Loading branch information
vmuzikar committed Aug 5, 2024
1 parent 99c8589 commit 20fd5ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.function.Consumer;
import java.util.regex.Pattern;

import io.smallrye.config.ConfigValue;
import io.smallrye.config.PropertiesConfigSource;

import org.keycloak.quarkus.runtime.cli.command.Main;
Expand Down Expand Up @@ -89,15 +90,14 @@ private static String getRawConfigArgs() {
}

@Override
public String getValue(String propertyName) {
Map<String, String> properties = getProperties();
String value = properties.get(propertyName);
public ConfigValue getConfigValue(String propertyName) {
ConfigValue value = super.getConfigValue(propertyName);

if (value != null) {
return value;
}

return properties.get(propertyName.replace(OPTION_PART_SEPARATOR_CHAR, '.'));
return super.getConfigValue(propertyName.replace(OPTION_PART_SEPARATOR_CHAR, '.'));
}

private static Map<String, String> parseArguments() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import io.smallrye.config.ConfigValue;
import io.smallrye.config.PropertiesConfigSource;
import org.keycloak.quarkus.runtime.Environment;

Expand All @@ -54,7 +55,7 @@ public final class PersistedConfigSource extends PropertiesConfigSource {
private static final ThreadLocal<Boolean> ENABLED = ThreadLocal.withInitial(() -> true);

private PersistedConfigSource() {
super(readProperties(), "", 200);
super(readProperties(), NAME, 200);
}

public static PersistedConfigSource getInstance() {
Expand All @@ -67,15 +68,15 @@ public String getName() {
}

@Override
public String getValue(String propertyName) {
public ConfigValue getConfigValue(String propertyName) {
if (isEnabled()) {
String value = super.getValue(propertyName);
ConfigValue value = super.getConfigValue(propertyName);

if (value != null) {
return value;
}

return super.getValue(propertyName.replace(Configuration.OPTION_PART_SEPARATOR_CHAR, '.'));
return super.getConfigValue(propertyName.replace(Configuration.OPTION_PART_SEPARATOR_CHAR, '.'));
}

return null;
Expand Down

0 comments on commit 20fd5ce

Please sign in to comment.