diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/src/main/java/org/kie/kogito/addons/quarkus/data/index/deployment/AbstractKogitoAddonsQuarkusDataIndexProcessor.java b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/src/main/java/org/kie/kogito/addons/quarkus/data/index/deployment/AbstractKogitoAddonsQuarkusDataIndexProcessor.java index c6235729b6..6a319765a7 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/src/main/java/org/kie/kogito/addons/quarkus/data/index/deployment/AbstractKogitoAddonsQuarkusDataIndexProcessor.java +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/src/main/java/org/kie/kogito/addons/quarkus/data/index/deployment/AbstractKogitoAddonsQuarkusDataIndexProcessor.java @@ -43,6 +43,12 @@ public abstract class AbstractKogitoAddonsQuarkusDataIndexProcessor extends OneO private static final String QUARKUS_HTTP_PORT = "quarkus.http.port"; private static final String KOGITO_SERVICE_URL_PROP = "kogito.service.url"; private static final String KOGITO_DATA_INDEX_PROP = "kogito.data-index.url"; + /** + * Skips the setting of the default kogito.data-index.url from the runtime url. + * This is convenient in scenarios like the dev-ui executing in k8s where want it to set this url using window + * location instead. Must be explicitly set to true to take effect. + */ + private static final String SKIP_DEFAULT_DATA_INDEX_URL_PROP = "kogito.data-index-addons.skip-default-data-index-url"; AbstractKogitoAddonsQuarkusDataIndexProcessor() { super(KogitoCapability.SERVERLESS_WORKFLOW, KogitoCapability.PROCESSES); @@ -50,12 +56,15 @@ public abstract class AbstractKogitoAddonsQuarkusDataIndexProcessor extends OneO @BuildStep(onlyIf = IsDevelopment.class) public void buildDefaultDataIndexURLSystemProperty(BuildProducer systemProperties) { - // Setting a default `kogito.data-index.url` accordingly to the runtime url. - String dataIndexUrl = ConfigProvider.getConfig().getOptionalValue(KOGITO_SERVICE_URL_PROP, String.class).orElseGet(() -> { - Integer port = ConfigProvider.getConfig().getOptionalValue(QUARKUS_HTTP_PORT, Integer.class).orElse(8080); - return "http://localhost:" + port; - }); - systemProperties.produce(new SystemPropertyBuildItem(KOGITO_DATA_INDEX_PROP, dataIndexUrl)); + boolean skipDefaultDataIndexUrl = ConfigProvider.getConfig().getOptionalValue(SKIP_DEFAULT_DATA_INDEX_URL_PROP, Boolean.class).orElse(false); + if (!skipDefaultDataIndexUrl) { + // Setting a default `kogito.data-index.url` accordingly to the runtime url. + String dataIndexUrl = ConfigProvider.getConfig().getOptionalValue(KOGITO_SERVICE_URL_PROP, String.class).orElseGet(() -> { + Integer port = ConfigProvider.getConfig().getOptionalValue(QUARKUS_HTTP_PORT, Integer.class).orElse(8080); + return "http://localhost:" + port; + }); + systemProperties.produce(new SystemPropertyBuildItem(KOGITO_DATA_INDEX_PROP, dataIndexUrl)); + } } @BuildStep(onlyIf = IsDevelopment.class)