From 62223117bd7e3e221d0cfc315076de507358982f Mon Sep 17 00:00:00 2001 From: Andrea Petrucci Date: Tue, 1 Oct 2024 11:40:36 +0200 Subject: [PATCH] changed port in config --- ZigZag/.env | 23 +++++++++++++++++++ .../ch/heia/ZigZag/service/TaskService.java | 8 +++---- .../src/main/resources/application.properties | 7 +++--- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 ZigZag/.env diff --git a/ZigZag/.env b/ZigZag/.env new file mode 100644 index 0000000..4ed4a17 --- /dev/null +++ b/ZigZag/.env @@ -0,0 +1,23 @@ +# Log level +LOG_LEVEL=debug + +# Environment +ENVIRONMENT=development + +# The Core engine URLs +ENGINE_URLS=["http://localhost:8080"] + +# The Service Port +SERVICE_PORT=9090 + +# The Service URL+Port +SERVICE_URL="http://localhost:${SERVICE_PORT}" + +# The maximum of tasks the service can process +MAX_TASKS=50 + +# The number of times the service tries to announce itself to the engine +ENGINE_ANNOUNCE_RETRIES=5 + +# The number of seconds between each retry +ENGINE_ANNOUNCE_RETRY_DELAY=3 \ No newline at end of file diff --git a/ZigZag/src/main/java/ch/heia/ZigZag/service/TaskService.java b/ZigZag/src/main/java/ch/heia/ZigZag/service/TaskService.java index 354b88f..0233c49 100644 --- a/ZigZag/src/main/java/ch/heia/ZigZag/service/TaskService.java +++ b/ZigZag/src/main/java/ch/heia/ZigZag/service/TaskService.java @@ -29,10 +29,8 @@ @Service public class TaskService { - - // Change this to an env variable instead of hard coding url. - private static final String SERVICE_URL = "https://ps4-2023-grp2.kube.isc.heia-fr.ch/zigzag"; - private static final String SERVICE_NAME = "zigzag"; + private static final String SERVICE_URL = System.getenv("SERVICE_URL"); + private static final String SERVICE_NAME = "zigzag-binarization"; private final BinarizationService binarizationService; private final StorageService storageService; @@ -71,6 +69,8 @@ public class TaskService { public TaskService(StorageService storageService, BinarizationService binarizationService) { this.storageService = storageService; this.binarizationService = binarizationService; + logger.info(SERVICE_NAME + " service started"); + logger.info("Service URL: " + SERVICE_URL); } diff --git a/ZigZag/src/main/resources/application.properties b/ZigZag/src/main/resources/application.properties index 6ce8f03..771ef0f 100644 --- a/ZigZag/src/main/resources/application.properties +++ b/ZigZag/src/main/resources/application.properties @@ -1,7 +1,8 @@ -UrlPrefix=${URL_PREFIX:} +# URL_PREFIX is root +UrlPrefix=${URL_PREFIX:/} server.error.include-message=always -server.port=8081 +server.port=80 spring.mvc.static-path-pattern=${UrlPrefix}/** -ServiceUrl=${SERVICE_URL:http://localhost:8081/zigzag} +ServiceUrl=${SERVICE_URL:http://localhost:80} # Set the OpenApi spec as requested by the iCoServices Documentation # springdoc.api-docs.path=${URL_PREFIX}/specification \ No newline at end of file