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

Introduce new configuration framework and update SmallRye Config version #5387

Merged
merged 39 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6a04719
Remove out of date comment from Agroal extension
dmlloyd Nov 11, 2019
bbdde15
Modify Dynamodb extension to correctly use Optional
dmlloyd Nov 11, 2019
744fa41
Move amazon-lambda build time config flag to buidl time class
dmlloyd Nov 11, 2019
219b78a
Modify ArC to use the standard config producer
dmlloyd Nov 11, 2019
2f2045f
Modify flyway extension to use Optional for empty lists
dmlloyd Nov 11, 2019
28c78b9
Modify Hibernate Search Elasticsearch to use Optional for empty lists
dmlloyd Nov 11, 2019
e514bdc
Move Jaeger enable flat to build time configuration
dmlloyd Nov 11, 2019
04bc8a2
Simplify kubernetes-client config slightly
dmlloyd Nov 11, 2019
da84cb6
Use Optional for empty list in mongodb-client
dmlloyd Nov 11, 2019
910406e
Move Narayana use of run time config to recorder method parameter
dmlloyd Nov 11, 2019
e3c8d6e
Use build time config to disable OIDC and use Optional for emptiable …
dmlloyd Nov 11, 2019
b453595
Do not cache config object in RestClientBase
dmlloyd Nov 11, 2019
876f545
Use Optional for empty list in security extension
dmlloyd Nov 11, 2019
84d72f8
Use ConfigProvider.getConfig() in smallrye-reactive-messaging
dmlloyd Nov 11, 2019
0e752b6
TikaProcessorTest must register a configuration now
dmlloyd Nov 11, 2019
fe1d5ff
Optional websocket config should be marked optional
dmlloyd Nov 11, 2019
c824124
No configuration is available when hot deployment happens
dmlloyd Nov 11, 2019
9e39fba
Move vertx-http build time config to separate class and use Optional …
dmlloyd Nov 11, 2019
801f9d6
Remove unused field fro vertx-web processor
dmlloyd Nov 11, 2019
e030c53
Modify test extension to properly layer configurations
dmlloyd Nov 11, 2019
e04b28b
Modify test framework to use a cleaner test URL setting and to clean …
dmlloyd Nov 11, 2019
4191c9e
Fix test extension integration test using test extension to provide a…
dmlloyd Nov 11, 2019
66fcfaf
Fix native image launcher so that it has a config at start
dmlloyd Nov 13, 2019
9dd3919
Introduce new configuration framework and update SmallRye Config version
dmlloyd Nov 11, 2019
beff399
TCK fixes to deal with property expansion
dmlloyd Nov 21, 2019
0a5b4b1
Update guide to clarify that roots are only available from their corr…
dmlloyd Nov 11, 2019
af47ab2
Add docs relating to optional and empty values and config groups
dmlloyd Nov 11, 2019
ee0f694
Tests for Map<String, Map<String, Xxx>> where Xxx is a leaf or config…
machi1990 Nov 12, 2019
55fa521
Blacklist RestEASY config source from native image for now
dmlloyd Nov 14, 2019
384c3dc
fix: doc generator so that config documentation website generator works
machi1990 Nov 14, 2019
37ce6d2
Support enabling/disabling expansion at run time
dmlloyd Nov 18, 2019
8423e6d
Add a doc note about clearing properties
dmlloyd Nov 19, 2019
34aa20e
Only add run time only config sources at run time, not during static …
dmlloyd Nov 20, 2019
bde05ba
Use GeneratedClassGizmoAdaptor in config classes
dmlloyd Nov 21, 2019
2187afb
Fix REST TCK issues by setting up a config as needed
dmlloyd Nov 21, 2019
fe745fb
Add @Override
dmlloyd Nov 22, 2019
4638078
Reduce usage of ConverterSupport to constant values
dmlloyd Nov 22, 2019
ab0a255
Add consistent trimming behavior to converters
dmlloyd Nov 22, 2019
c57d90c
Disable failing test (see #5175)
dmlloyd Nov 22, 2019
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
7 changes: 6 additions & 1 deletion bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<microprofile-opentracing-api.version>1.3.1</microprofile-opentracing-api.version>
<microprofile-reactive-streams-operators.version>1.0</microprofile-reactive-streams-operators.version>
<microprofile-rest-client.version>1.3.4</microprofile-rest-client.version>
<smallrye-config.version>1.3.9</smallrye-config.version>
<smallrye-config.version>1.4.1</smallrye-config.version>
<smallrye-health.version>2.1.0</smallrye-health.version>
<smallrye-metrics.version>2.3.1</smallrye-metrics.version>
<smallrye-open-api.version>1.1.20</smallrye-open-api.version>
Expand Down Expand Up @@ -1083,6 +1083,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-config-common</artifactId>
<version>${smallrye-config.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-health</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
import java.util.Properties;
import java.util.function.Consumer;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigBuilder;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
import org.jboss.logging.Logger;

import io.quarkus.bootstrap.BootstrapDependencyProcessingException;
Expand All @@ -36,8 +38,11 @@
import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
import io.quarkus.deployment.pkg.builditem.JarBuildItem;
import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.quarkus.runtime.configuration.QuarkusConfigFactory;
import io.smallrye.config.PropertiesConfigSource;
import io.smallrye.config.SmallRyeConfigProviderResolver;
import io.smallrye.config.SmallRyeConfig;
import io.smallrye.config.SmallRyeConfigBuilder;

/**
* This phase consumes {@link CurateOutcome} and processes
Expand Down Expand Up @@ -110,32 +115,25 @@ public AugmentOutcome run(CurateOutcome appState, CuratedApplicationCreator ctx)
}
//first lets look for some config, as it is not on the current class path
//and we need to load it to run the build process
Path config = configDir.resolve("application.properties");
if (Files.exists(config)) {
Path configPath = configDir.resolve("application.properties");
SmallRyeConfigBuilder configBuilder = ConfigUtils.configBuilder(false);
if (Files.exists(configPath)) {
try {
ConfigBuilder builder = SmallRyeConfigProviderResolver.instance().getBuilder()
.addDefaultSources()
.addDiscoveredConverters()
.addDiscoveredSources()
.withSources(new PropertiesConfigSource(config.toUri().toURL()));

if (configCustomizer != null) {
configCustomizer.accept(builder);
}
SmallRyeConfigProviderResolver.instance().registerConfig(builder.build(),
Thread.currentThread().getContextClassLoader());
} catch (Exception e) {
throw new RuntimeException(e);
configBuilder.withSources(new PropertiesConfigSource(configPath.toUri().toURL()));
} catch (IOException e) {
throw new IllegalArgumentException("Failed to convert config URL", e);
}
} else if (configCustomizer != null) {
ConfigBuilder builder = SmallRyeConfigProviderResolver.instance().getBuilder()
.addDefaultSources()
.addDiscoveredConverters()
.addDiscoveredSources();

configCustomizer.accept(builder);
SmallRyeConfigProviderResolver.instance().registerConfig(builder.build(),
Thread.currentThread().getContextClassLoader());
}
if (configCustomizer != null) {
configCustomizer.accept(configBuilder);
}
final SmallRyeConfig config = configBuilder.build();
QuarkusConfigFactory.setConfig(config);
final ConfigProviderResolver cpr = ConfigProviderResolver.instance();
final Config existing = cpr.getConfig();
if (existing != config) {
cpr.releaseConfig(existing);
// subsequent calls will get the new config
}

final AppModelResolver depResolver = appState.getArtifactResolver();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.regex.Pattern;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
import org.jboss.logging.Logger;

import io.quarkus.bootstrap.BootstrapDependencyProcessingException;
Expand All @@ -40,8 +41,11 @@
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.util.FileUtil;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.quarkus.runtime.configuration.QuarkusConfigFactory;
import io.smallrye.config.PropertiesConfigSource;
import io.smallrye.config.SmallRyeConfigProviderResolver;
import io.smallrye.config.SmallRyeConfig;
import io.smallrye.config.SmallRyeConfigBuilder;

/**
* This phase generates an example configuration file
Expand All @@ -65,12 +69,16 @@ public Path run(CurateOutcome appState, CuratedApplicationCreator creator) throw
//TODO: do we actually need to load this config? Does it affect resolution?
if (Files.exists(configFile)) {
try {
Config built = SmallRyeConfigProviderResolver.instance().getBuilder()
.addDefaultSources()
.addDiscoveredConverters()
.addDiscoveredSources()
.withSources(new PropertiesConfigSource(configFile.toUri().toURL())).build();
SmallRyeConfigProviderResolver.instance().registerConfig(built, Thread.currentThread().getContextClassLoader());
SmallRyeConfigBuilder builder = ConfigUtils.configBuilder(false)
.withSources(new PropertiesConfigSource(configFile.toUri().toURL()));
final SmallRyeConfig config = builder.build();
QuarkusConfigFactory.setConfig(config);
final ConfigProviderResolver cpr = ConfigProviderResolver.instance();
final Config existing = cpr.getConfig();
if (existing != config) {
cpr.releaseConfig(existing);
// subsequent calls will get the new config
}
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.deployment;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
Expand All @@ -12,12 +14,12 @@ public class ApplicationConfig {
* If not set, defaults to the name of the project.
*/
@ConfigItem
public String name;
public Optional<String> name;

/**
* The version of the application.
* If not set, defaults to the version of the project
*/
@ConfigItem
public String version;
public Optional<String> version;
}
Loading