From da8df759bdd7af5de834930db638f213798c1ad2 Mon Sep 17 00:00:00 2001 From: Ryan Amari Date: Tue, 19 Nov 2024 15:41:47 -0500 Subject: [PATCH] ALS-7810: Fix dictionary config --- .../processing/dictionary/DictionaryService.java | 13 ++++++++++--- .../resources/application-development.properties | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/dictionary/DictionaryService.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/dictionary/DictionaryService.java index f5f5bfaf..653f1907 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/dictionary/DictionaryService.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/dictionary/DictionaryService.java @@ -1,16 +1,18 @@ package edu.harvard.hms.dbmi.avillach.hpds.processing.dictionary; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import java.util.List; -@Component +@Service @ConditionalOnProperty("dictionary.host") public class DictionaryService { @@ -19,8 +21,13 @@ public class DictionaryService { private final String dictionaryHost; private final RestTemplate restTemplate; - public DictionaryService(@Value("${dictionary.host}") String dictionaryHostTemplate, @Value("${TARGET_STACK}") String targetStack) { - this.dictionaryHost = dictionaryHostTemplate.replace("___TARGET_STACK___", targetStack); + @Autowired + public DictionaryService(@Value("${dictionary.host}") String dictionaryHostTemplate, @Value("${TARGET_STACK:}") String targetStack) { + if (targetStack != null && !targetStack.isEmpty()) { + this.dictionaryHost = dictionaryHostTemplate.replace("___TARGET_STACK___", targetStack); + } else { + this.dictionaryHost = dictionaryHostTemplate; + } this.restTemplate = new RestTemplate(); } diff --git a/service/src/main/resources/application-development.properties b/service/src/main/resources/application-development.properties index 16c335d2..5768ef1b 100644 --- a/service/src/main/resources/application-development.properties +++ b/service/src/main/resources/application-development.properties @@ -2,5 +2,4 @@ SMALL_JOB_LIMIT = 100 SMALL_TASK_THREADS = 1 LARGE_TASK_THREADS = 1 -hpds.genomicProcessor.impl=localDistributed -HPDS_GENOMIC_DATA_DIRECTORY=/opt/local/hpds/all/ \ No newline at end of file +dictionary.host = http://wildfly.___TARGET_STACK___:8080/ \ No newline at end of file