Search in sources :

Example 1 with TempSystemProperties

use of io.quarkus.dev.console.TempSystemProperties in project quarkus by quarkusio.

the class RebuildHandler method handlePostAsync.

@Override
protected void handlePostAsync(RoutingContext event, MultiMap form) throws Exception {
    QuarkusBootstrap existing = (QuarkusBootstrap) DevConsoleManager.getQuarkusBootstrap();
    try (TempSystemProperties properties = new TempSystemProperties()) {
        for (Map.Entry<String, String> i : config.entrySet()) {
            properties.set(i.getKey(), i.getValue());
        }
        for (Map.Entry<String, String> i : form.entries()) {
            if (!i.getValue().isEmpty()) {
                properties.set(i.getKey(), i.getValue());
            }
        }
        QuarkusBootstrap quarkusBootstrap = existing.clonedBuilder().setMode(QuarkusBootstrap.Mode.PROD).setIsolateDeployment(true).build();
        try (CuratedApplication bootstrap = quarkusBootstrap.bootstrap()) {
            AugmentResult augmentResult = bootstrap.createAugmentor().createProductionApplication();
            List<ArtifactResult> containerArtifactResults = augmentResult.resultsMatchingType((s) -> s.contains("container"));
            if (containerArtifactResults.size() >= 1) {
                flashMessage(event, "Container-image: " + containerArtifactResults.get(0).getMetadata().get("container-image") + " created.", Duration.ofSeconds(10));
            }
        }
    }
    ;
}
Also used : TempSystemProperties(io.quarkus.dev.console.TempSystemProperties) CuratedApplication(io.quarkus.bootstrap.app.CuratedApplication) QuarkusBootstrap(io.quarkus.bootstrap.app.QuarkusBootstrap) AugmentResult(io.quarkus.bootstrap.app.AugmentResult) Map(java.util.Map) MultiMap(io.vertx.core.MultiMap) ArtifactResult(io.quarkus.bootstrap.app.ArtifactResult)

Aggregations

ArtifactResult (io.quarkus.bootstrap.app.ArtifactResult)1 AugmentResult (io.quarkus.bootstrap.app.AugmentResult)1 CuratedApplication (io.quarkus.bootstrap.app.CuratedApplication)1 QuarkusBootstrap (io.quarkus.bootstrap.app.QuarkusBootstrap)1 TempSystemProperties (io.quarkus.dev.console.TempSystemProperties)1 MultiMap (io.vertx.core.MultiMap)1 Map (java.util.Map)1