From ac39dafafe3426703afb69b68a75a0917199c49b Mon Sep 17 00:00:00 2001 From: Gael Leblan Date: Thu, 16 May 2024 20:34:43 +0200 Subject: [PATCH] Revert "[frontend/backend] Adding the correct version of RabbitMQ (#841)" This reverts commit 03910a4d0e0c6f75cd77258c28ab74c51da7ba48. --- .../io/openbas/helper/RabbitMQHelper.java | 45 ------------------- .../rest/settings/PlatformSettingsApi.java | 4 -- .../settings/response/PlatformSettings.java | 8 +--- .../java/io/openbas/config/OpenBASConfig.java | 5 +-- .../admin/components/settings/Parameters.tsx | 2 +- openbas-front/src/utils/api-types.d.ts | 1 - 6 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 openbas-api/src/main/java/io/openbas/helper/RabbitMQHelper.java diff --git a/openbas-api/src/main/java/io/openbas/helper/RabbitMQHelper.java b/openbas-api/src/main/java/io/openbas/helper/RabbitMQHelper.java deleted file mode 100644 index 2731086c9c..0000000000 --- a/openbas-api/src/main/java/io/openbas/helper/RabbitMQHelper.java +++ /dev/null @@ -1,45 +0,0 @@ -package io.openbas.helper; - -import io.openbas.config.OpenBASConfig; -import org.springframework.boot.json.BasicJsonParser; -import org.springframework.http.*; -import org.springframework.web.client.RestTemplate; - -import java.util.Collections; - -public class RabbitMQHelper { - - private static String rabbitMQVersion; - - /** - * Return the version of Rabbit MQ we're using - * - * @return the rabbit MQ version - */ - public static String getRabbitMQVersion(OpenBASConfig openBASConfig) { - // If we already have the version, we don't need to get it again - if (rabbitMQVersion == null) { - RestTemplate restTemplate = new RestTemplate(); - // Init the rabbit MQ management api overview url - String uri = openBASConfig.isRabbitmqSsl() ? "https://" : "http://" - + openBASConfig.getRabbitmqHostname() + ":" + openBASConfig.getRabbitmqManagementPort() - + "/api/overview"; - - // Init the headers - HttpHeaders headers = new HttpHeaders(); - headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); - headers.setBasicAuth(openBASConfig.getRabbitmqUser(), openBASConfig.getRabbitmqPass()); - HttpEntity entity = new HttpEntity<>("parameters", headers); - - // Make the call - ResponseEntity result = - restTemplate.exchange(uri, HttpMethod.GET, entity, String.class); - - // Init the parser to get the rabbit_mq version - BasicJsonParser jsonParser = new BasicJsonParser(); - rabbitMQVersion = (String) jsonParser.parseMap((String) result.getBody()).get("rabbitmq_version"); - } - - return rabbitMQVersion; - } -} diff --git a/openbas-api/src/main/java/io/openbas/rest/settings/PlatformSettingsApi.java b/openbas-api/src/main/java/io/openbas/rest/settings/PlatformSettingsApi.java index 691133e811..f300a35ecf 100644 --- a/openbas-api/src/main/java/io/openbas/rest/settings/PlatformSettingsApi.java +++ b/openbas-api/src/main/java/io/openbas/rest/settings/PlatformSettingsApi.java @@ -6,7 +6,6 @@ import io.openbas.database.model.Theme; import io.openbas.database.repository.SettingRepository; import io.openbas.executors.caldera.config.CalderaExecutorConfig; -import io.openbas.helper.RabbitMQHelper; import io.openbas.injectors.opencti.config.OpenCTIConfig; import io.openbas.rest.helper.RestBehavior; import io.openbas.rest.settings.form.SettingsEnterpriseEditionUpdateInput; @@ -58,8 +57,6 @@ public class PlatformSettingsApi extends RestBehavior { private CalderaExecutorConfig calderaExecutorConfig; - private String rabbitMQVersion = null; - @Resource private OpenBASConfig openBASConfig; @@ -208,7 +205,6 @@ public PlatformSettings settings() { platformSettings.setPlatformVersion(openBASConfig.getVersion()); platformSettings.setPostgreVersion(settingRepository.getServerVersion()); platformSettings.setJavaVersion(Runtime.version().toString()); - platformSettings.setRabbitMQVersion(RabbitMQHelper.getRabbitMQVersion(openBASConfig)); } } diff --git a/openbas-api/src/main/java/io/openbas/rest/settings/response/PlatformSettings.java b/openbas-api/src/main/java/io/openbas/rest/settings/response/PlatformSettings.java index 0c95e1971e..8bddbed28b 100644 --- a/openbas-api/src/main/java/io/openbas/rest/settings/response/PlatformSettings.java +++ b/openbas-api/src/main/java/io/openbas/rest/settings/response/PlatformSettings.java @@ -2,10 +2,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.openbas.rest.settings.form.ThemeInput; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; +import lombok.*; import java.util.List; @@ -66,9 +63,6 @@ public class PlatformSettings { @JsonProperty("java_version") private String javaVersion; - @JsonProperty("rabbitmq_version") - private String rabbitMQVersion; - @JsonProperty("platform_ai_enabled") private Boolean aiEnabled; diff --git a/openbas-framework/src/main/java/io/openbas/config/OpenBASConfig.java b/openbas-framework/src/main/java/io/openbas/config/OpenBASConfig.java index c25e7f843b..40b6d16110 100644 --- a/openbas-framework/src/main/java/io/openbas/config/OpenBASConfig.java +++ b/openbas-framework/src/main/java/io/openbas/config/OpenBASConfig.java @@ -56,12 +56,9 @@ public class OpenBASConfig { @JsonProperty("rabbitmq_ssl") private boolean rabbitmqSsl = false; - @JsonProperty("rabbitmq_port") + @JsonProperty("rabbitmq_ssl") private int rabbitmqPort = 5672; - @JsonProperty("rabbitmq_management_port") - private int rabbitmqManagementPort = 15672; - @JsonProperty("rabbitmq_user") private String rabbitmqUser = "guest"; diff --git a/openbas-front/src/admin/components/settings/Parameters.tsx b/openbas-front/src/admin/components/settings/Parameters.tsx index 35c4740920..21f073507e 100644 --- a/openbas-front/src/admin/components/settings/Parameters.tsx +++ b/openbas-front/src/admin/components/settings/Parameters.tsx @@ -192,7 +192,7 @@ const Parameters = () => { - + diff --git a/openbas-front/src/utils/api-types.d.ts b/openbas-front/src/utils/api-types.d.ts index 8bc3b856e3..e025ec3121 100644 --- a/openbas-front/src/utils/api-types.d.ts +++ b/openbas-front/src/utils/api-types.d.ts @@ -1878,7 +1878,6 @@ export interface PlatformSettings { platform_version?: string; platform_whitemark?: string; postgre_version?: string; - rabbitmq_version?: string; xtm_opencti_enable?: boolean; xtm_opencti_url?: string; }