This is an automated email from the ASF dual-hosted git repository.

wmedvedeo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-apps.git


The following commit(s) were added to refs/heads/main by this push:
     new a0812e4ff kie-kogito-apps-issues-2083: Add the possibility of 
disabling the default data-index-url calculation in the data-index-addon (#2084)
a0812e4ff is described below

commit a0812e4ff2eceb0588c67202653b23379d408318
Author: Walter Medvedeo <[email protected]>
AuthorDate: Fri Aug 2 14:35:13 2024 +0200

    kie-kogito-apps-issues-2083: Add the possibility of disabling the default 
data-index-url calculation in the data-index-addon (#2084)
---
 ...stractKogitoAddonsQuarkusDataIndexProcessor.java | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

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 c6235729b..6a319765a 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<SystemPropertyBuildItem> 
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)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to