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

Replaced Quarkus Config Profiles and Expansion with SmallRye Config #9184

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<microprofile-opentracing-api.version>1.3.3</microprofile-opentracing-api.version>
<microprofile-reactive-streams-operators.version>1.0.1</microprofile-reactive-streams-operators.version>
<microprofile-rest-client.version>1.4.1</microprofile-rest-client.version>
<smallrye-config.version>1.7.0</smallrye-config.version>
<smallrye-config.version>1.8.1</smallrye-config.version>
<smallrye-health.version>2.2.1</smallrye-health.version>
<smallrye-metrics.version>2.4.2</smallrye-metrics.version>
<smallrye-open-api.version>1.2.4</smallrye-open-api.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.quarkus.runtime.configuration.ExpandingConfigSource;
import io.quarkus.runtime.configuration.HyphenateEnumConverter;
import io.quarkus.runtime.configuration.NameIterator;
import io.smallrye.config.Converters;
import io.smallrye.config.Expressions;
import io.smallrye.config.SmallRyeConfig;

/**
Expand Down Expand Up @@ -354,13 +354,9 @@ ReadResult run() {
matched = runTimePatternMap.match(ni);
if (matched != null) {
// it's a specified run-time default (record for later)
boolean old = ExpandingConfigSource.setExpanding(false);
try {
specifiedRunTimeDefaultValues.put(propertyName,
config.getOptionalValue(propertyName, String.class).orElse(""));
} finally {
ExpandingConfigSource.setExpanding(old);
}
specifiedRunTimeDefaultValues.put(propertyName, Expressions.withoutExpansion(
() -> config.getOptionalValue(propertyName, String.class).orElse("")));

continue;
}
// also check for the bootstrap properties since those need to be added to specifiedRunTimeDefaultValues as well
Expand All @@ -369,23 +365,13 @@ ReadResult run() {
matched = bootstrapPatternMap.match(ni);
if (matched != null) {
// it's a specified run-time default (record for later)
boolean old = ExpandingConfigSource.setExpanding(false);
try {
specifiedRunTimeDefaultValues.put(propertyName,
config.getOptionalValue(propertyName, String.class).orElse(""));
} finally {
ExpandingConfigSource.setExpanding(old);
}
specifiedRunTimeDefaultValues.put(propertyName, Expressions.withoutExpansion(
() -> config.getOptionalValue(propertyName, String.class).orElse("")));
}
} else {
// it's not managed by us; record it
boolean old = ExpandingConfigSource.setExpanding(false);
try {
specifiedRunTimeDefaultValues.put(propertyName,
config.getOptionalValue(propertyName, String.class).orElse(""));
} finally {
ExpandingConfigSource.setExpanding(old);
}
specifiedRunTimeDefaultValues.put(propertyName, Expressions.withoutExpansion(
() -> config.getOptionalValue(propertyName, String.class).orElse("")));
}
}
return new ReadResult(objectsByRootClass, specifiedRunTimeDefaultValues, buildTimeRunTimeVisibleValues,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final b
final ApplicationPropertiesConfigSource.InJar inJar = new ApplicationPropertiesConfigSource.InJar();
final ApplicationPropertiesConfigSource.MpConfigInJar mpConfig = new ApplicationPropertiesConfigSource.MpConfigInJar();
builder.withSources(inFileSystem, inJar, mpConfig, new DotEnvConfigSource());
final ExpandingConfigSource.Cache cache = new ExpandingConfigSource.Cache();
builder.withWrapper(ExpandingConfigSource.wrapper(cache));
builder.withWrapper(DeploymentProfileConfigSource.wrapper());
builder.withProfile(ProfileManager.getActiveProfile());
builder.addDefaultInterceptors();
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (runTime) {
builder.addDefaultSources();
Expand All @@ -92,6 +91,7 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final b
}
if (addDiscovered) {
builder.addDiscoveredSources();
builder.addDiscoveredInterceptors();
builder.addDiscoveredConverters();
}
return builder;
Expand Down

This file was deleted.

This file was deleted.

Loading