From 097db1642f14baa4817b82bdde529885bb35dfee Mon Sep 17 00:00:00 2001 From: Michael Buckley Date: Thu, 7 Oct 2021 15:14:06 -0400 Subject: [PATCH] Add local_base_urls configuration to feed DaoConfig.setTreatBaseUrlsAsLocal() --- .../ca/uhn/fhir/jpa/starter/AppProperties.java | 16 +++++++++++----- .../fhir/jpa/starter/FhirServerConfigCommon.java | 2 ++ .../resources/application-integrationtest.yaml | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java index aa14015..78d6660 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -11,10 +11,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; @ConfigurationProperties(prefix = "hapi.fhir") @Configuration @@ -77,6 +74,7 @@ public class AppProperties { private Integer bundle_batch_pool_size = 20; private Integer bundle_batch_pool_max_size = 100; + private List local_base_urls = new ArrayList<>(); public Boolean getUse_apache_address_strategy() { return use_apache_address_strategy; @@ -190,7 +188,11 @@ public class AppProperties { this.supported_resource_types = supported_resource_types; } - public Logger getLogger() { + public List getSupported_resource_types(List supported_resource_types) { + return this.supported_resource_types; + } + + public Logger getLogger() { return logger; } @@ -499,6 +501,10 @@ public class AppProperties { this.bundle_batch_pool_max_size = bundle_batch_pool_max_size; } + public List getLocal_base_urls() { + return local_base_urls; + } + public static class Cors { private Boolean allow_Credentials = true; private List allowed_origin = ImmutableList.of("*"); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java index 63f675f..7310fe0 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java @@ -26,6 +26,7 @@ import org.springframework.context.annotation.Primary; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; +import java.util.HashSet; import java.util.Optional; /** @@ -121,6 +122,7 @@ public class FhirServerConfigCommon { retVal.setFilterParameterEnabled(appProperties.getFilter_search_enabled()); retVal.setAdvancedLuceneIndexing(appProperties.getAdvanced_lucene_indexing()); + retVal.setTreatBaseUrlsAsLocal(new HashSet<>(appProperties.getLocal_base_urls())); return retVal; } diff --git a/src/test/resources/application-integrationtest.yaml b/src/test/resources/application-integrationtest.yaml index b19a14b..6afbcbf 100644 --- a/src/test/resources/application-integrationtest.yaml +++ b/src/test/resources/application-integrationtest.yaml @@ -34,6 +34,8 @@ hapi: # fhirpath_interceptor_enabled: false # filter_search_enabled: true # graphql_enabled: true +# local_base_urls: +# - http://hapi.fhir.org/baseR4 #partitioning: # cross_partition_reference_mode: true # multitenancy_enabled: true