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

kie-kogito-apps-issues-2083: Add the possibility of disabling the default data-index-url calculation in the data-index-addon #2084

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,28 @@ 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);
}

@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)
Expand Down
Loading