Skip to content
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

feature(config-api): Make MPCONFIG in TranslatedConfigView debugable / FISH-1079 #5129

Merged
merged 4 commits into from
Feb 24, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import com.sun.enterprise.security.store.DomainScopedPasswordAliasStore;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigValue;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
import org.glassfish.hk2.api.ServiceLocator;
import org.jvnet.hk2.config.ConfigBeanProxy;
Expand Down Expand Up @@ -146,13 +147,17 @@ private static Object getTranslatedValue(Object value) {
String matchValue = envValue[0];
String defaultValue = envValue.length > 1 ? envValue[1] : null;
Config config = configResolver().getConfig();
Optional<String> newValue = config.getOptionalValue(matchValue, String.class);
if (newValue != null && newValue.isPresent()) {
stringValue = m3.replaceFirst(Matcher.quoteReplacement(m3.group(1) + newValue.get() + m3.group(3)));
ConfigValue configValue = config.getConfigValue(matchValue);
String newValue = configValue.getValue();
if (newValue != null && ! newValue.isEmpty()) {
Pandrex247 marked this conversation as resolved.
Show resolved Hide resolved
stringValue = m3.replaceFirst(Matcher.quoteReplacement(m3.group(1) + newValue + m3.group(3)));
m3.reset(stringValue);
Logger.getAnonymousLogger().fine("Found property '"+matchValue+"' in source '"+configValue.getSourceName()+"' with ordinal '"+configValue.getSourceOrdinal()+"'");
Pandrex247 marked this conversation as resolved.
Show resolved Hide resolved
} else if (defaultValue != null) {
stringValue = defaultValue;
break;
} else {
Logger.getAnonymousLogger().warning("MicroProfile Config: property '"+matchValue+"': no value found, no default given.");
Pandrex247 marked this conversation as resolved.
Show resolved Hide resolved
}
i++;
}
Expand Down