From d095312f343d2fc7c56a8b5e8d96813ab19bf641 Mon Sep 17 00:00:00 2001
From: ThanKarab <tkarabatsis@hotmail.com>
Date: Mon, 13 Feb 2023 16:51:32 +0200
Subject: [PATCH] DisabledAlgorithms.json added as hardcoded file.

The file no longer needs to be mounted.
Diabled algorithm 'THREE_C'.
---
 Dockerfile                                           | 12 ++++++------
 config/application.tmpl                              |  2 +-
 config/disabledAlgorithms.json                       |  2 +-
 .../java/eu/hbp/mip/services/AlgorithmService.java   |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 78a234728..fabf7f0c4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -29,9 +29,9 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
 #######################################################
 # Setting up env variables and workdir
 #######################################################
-ENV APP_CONFIG_TEMPLATE="/opt/config/application.tmpl" \
-    APP_CONFIG_LOCATION="/opt/config/application.yml" \
-    SPRING_CONFIG_LOCATION="file:/opt/config/application.yml"
+ENV APP_CONFIG_TEMPLATE="/opt/config/application.tmpl"
+ENV APP_CONFIG_LOCATION="/opt/config/application.yml"
+ENV SPRING_CONFIG_LOCATION="file:/opt/config/application.yml"
 
 WORKDIR /opt
 
@@ -53,13 +53,13 @@ COPY --from=mvn-build-env /opt/code/target/portal-backend.jar /usr/share/jars/
 
 
 #######################################################
-# Volume for the backend config files
+# Configuration for the backend config files
 #######################################################
+ENV DISABLED_ALGORITHMS_CONFIG_PATH="/opt/portal/algorithms/disabledAlgorithms.json"
+COPY /config/disabledAlgorithms.json $DISABLED_ALGORITHMS_CONFIG_PATH
 VOLUME /opt/portal/api
 
 
 ENTRYPOINT ["sh", "-c", "dockerize -template $APP_CONFIG_TEMPLATE:$APP_CONFIG_LOCATION java -Daeron.term.buffer.length -jar /usr/share/jars/portal-backend.jar"]
 EXPOSE 8080
 HEALTHCHECK --start-period=60s CMD curl -v --silent http://localhost:8080/services/actuator/health 2>&1 | grep UP
-
-
diff --git a/config/application.tmpl b/config/application.tmpl
index 0a309c1af..415e9f469 100644
--- a/config/application.tmpl
+++ b/config/application.tmpl
@@ -69,7 +69,7 @@ keycloak:
 # Files are imported when building the docker image
 files:
   pathologies_json: "file:/opt/portal/api/pathologies.json"
-  disabledAlgorithms_json: "file:/opt/portal/api/disabledAlgorithms.json"
+  disabledAlgorithms_json: "file:{{ .Env.DISABLED_ALGORITHMS_CONFIG_PATH}}"
 
 
 ### EMBEDDED SERVER CONFIGURATION ###
diff --git a/config/disabledAlgorithms.json b/config/disabledAlgorithms.json
index d92a3b2f1..9c832491d 100644
--- a/config/disabledAlgorithms.json
+++ b/config/disabledAlgorithms.json
@@ -1,3 +1,3 @@
 [
-	"3C"
+	"THREE_C"
 ]
\ No newline at end of file
diff --git a/src/main/java/eu/hbp/mip/services/AlgorithmService.java b/src/main/java/eu/hbp/mip/services/AlgorithmService.java
index bfc2b7c7f..dd2d605b6 100644
--- a/src/main/java/eu/hbp/mip/services/AlgorithmService.java
+++ b/src/main/java/eu/hbp/mip/services/AlgorithmService.java
@@ -101,7 +101,7 @@ public class AlgorithmService {
         try {
             disabledAlgorithms = getDisabledAlgorithms();
         } catch (IOException e) {
-            logger.LogUserAction("The disabled algorithms could not be loaded.");
+            logger.LogUserAction("The disabled algorithms could not be loaded. Exception: " + e.getMessage());
         }
 
         // Remove any disabled algorithm
-- 
GitLab