Skip to content

Commit

Permalink
config: switch to quarkus.camel..enabled pattern instead of quarkus.c…
Browse files Browse the repository at this point in the history
…amel.-enabled to enable/disable features
  • Loading branch information
lburgazzoli committed Nov 12, 2019
1 parent 53a6c75 commit e09d801
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected void addReflectiveMethod(MethodInfo mi) {

/*
* NativeImage configuration steps related to camel main that are activated by default but can be
* disabled by setting quarkus.camel.enable-main = false
* disabled by setting quarkus.camel.main.enabled = false
*/
public static class Main {
@BuildStep(onlyIf = Flags.MainEnabled.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,29 @@
*/
package org.apache.camel.quarkus.core;

import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "camel", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
public class CamelConfig {
/**
* Enable {@code camel-main}. If {@code true}, routes are automatically
* loaded and started and the entire lifecycle of the Camel Context is
* under the control of the {@code camel-main} component. Otherwise, the
* application developer is responsible for performing all the mentioned
* tasks.
* Build time configuration options for {@code camel-main}.
*/
@ConfigItem(defaultValue = "true")
public boolean enableMain;
@ConfigItem
public MainConfig main;

@ConfigGroup
public static class MainConfig {
/**
* Enable {@code camel-main}. If {@code true}, routes are automatically
* loaded and started and the entire lifecycle of the Camel Context is
* under the control of the {@code camel-main} component. Otherwise, the
* application developer is responsible for performing all the mentioned
* tasks.
*/
@ConfigItem(defaultValue = "true")
public boolean enabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ private Flags() {
public static final class MainEnabled implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.enable-main", Boolean.class).orElse(Boolean.TRUE);
return ConfigProvider.getConfig().getOptionalValue("quarkus.camel.main.enabled", Boolean.class)
.orElse(Boolean.TRUE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ quarkus.log.file.enable = false
#
# Quarkus :: Camel
#
quarkus.camel.enable-main=false
quarkus.camel.main.enabled=false

#
# Camel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ quarkus.log.file.enable = false
#
# Quarkus :: Camel
#
quarkus.camel.enable-main=false
quarkus.camel.main.enabled=false

#
# Camel
Expand Down

0 comments on commit e09d801

Please sign in to comment.