Further adaption of new config class
This commit is contained in:
@@ -32,18 +32,17 @@ public class AppProperties {
|
|||||||
private Boolean graphql_enabled = true;
|
private Boolean graphql_enabled = true;
|
||||||
private Boolean binary_storage_enabled = true;
|
private Boolean binary_storage_enabled = true;
|
||||||
private Boolean bulk_export_enabled = true;
|
private Boolean bulk_export_enabled = true;
|
||||||
|
private Integer max_binary_size = 104857600;
|
||||||
|
private Integer max_page_size = Integer.MAX_VALUE;
|
||||||
|
private Integer retain_cached_searches_mins = 60;
|
||||||
|
private Long reuse_cached_search_results_millis = 60000L;
|
||||||
private EncodingEnum default_encoding = EncodingEnum.JSON;
|
private EncodingEnum default_encoding = EncodingEnum.JSON;
|
||||||
private FhirVersionEnum fhir_version = FhirVersionEnum.R4;
|
private FhirVersionEnum fhir_version = FhirVersionEnum.R4;
|
||||||
private Integer max_binary_size = 104857600;
|
|
||||||
private Integer max_page_size = 200;
|
|
||||||
private Integer retain_cached_searches_mins = 60;
|
|
||||||
private Integer reuse_cached_search_results_millis = 60000;
|
|
||||||
private ClientIdStrategyEnum client_id_strategy = ClientIdStrategyEnum.ALPHANUMERIC;
|
private ClientIdStrategyEnum client_id_strategy = ClientIdStrategyEnum.ALPHANUMERIC;
|
||||||
|
|
||||||
|
private Validation validation = new Validation();
|
||||||
private Validation validation;
|
private Tester tester = new Tester();
|
||||||
private Server server;
|
private Logger logger = new Logger();
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
public Validation getValidation() {
|
public Validation getValidation() {
|
||||||
return validation;
|
return validation;
|
||||||
@@ -53,12 +52,12 @@ public class AppProperties {
|
|||||||
this.validation = validation;
|
this.validation = validation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Server getServer() {
|
public Tester getTester() {
|
||||||
return server;
|
return tester;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServer(Server server) {
|
public void setTester(Tester tester) {
|
||||||
this.server = server;
|
this.tester = tester;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Logger getLogger() {
|
public Logger getLogger() {
|
||||||
@@ -266,11 +265,11 @@ public class AppProperties {
|
|||||||
this.retain_cached_searches_mins = retain_cached_searches_mins;
|
this.retain_cached_searches_mins = retain_cached_searches_mins;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getReuse_cached_search_results_millis() {
|
public Long getReuse_cached_search_results_millis() {
|
||||||
return reuse_cached_search_results_millis;
|
return reuse_cached_search_results_millis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReuse_cached_search_results_millis(Integer reuse_cached_search_results_millis) {
|
public void setReuse_cached_search_results_millis(Long reuse_cached_search_results_millis) {
|
||||||
this.reuse_cached_search_results_millis = reuse_cached_search_results_millis;
|
this.reuse_cached_search_results_millis = reuse_cached_search_results_millis;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +314,7 @@ public class AppProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Server {
|
public static class Tester {
|
||||||
|
|
||||||
private String id = "home";
|
private String id = "home";
|
||||||
private String name = "Local Tester";
|
private String name = "Local Tester";
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
@@ -13,8 +12,6 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||||||
|
|
||||||
@ServletComponentScan(basePackageClasses = {JpaRestfulServer.class}, basePackages = "ca.uhn.fhir.jpa.starter")
|
@ServletComponentScan(basePackageClasses = {JpaRestfulServer.class}, basePackages = "ca.uhn.fhir.jpa.starter")
|
||||||
@SpringBootApplication(exclude = ElasticsearchRestClientAutoConfiguration.class)
|
@SpringBootApplication(exclude = ElasticsearchRestClientAutoConfiguration.class)
|
||||||
@EnableConfigurationProperties
|
|
||||||
@EnableAutoConfiguration
|
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class FhirServerConfigCommon {
|
|||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
|
||||||
|
|
||||||
|
|
||||||
private Boolean enableIndexMissingFields = HapiProperties.getEnableIndexMissingFields();
|
private Boolean enableIndexMissingFields = HapiProperties.getEnableIndexMissingFields();
|
||||||
private Boolean autoCreatePlaceholderReferenceTargets = HapiProperties.getAutoCreatePlaceholderReferenceTargets();
|
private Boolean autoCreatePlaceholderReferenceTargets = HapiProperties.getAutoCreatePlaceholderReferenceTargets();
|
||||||
private Boolean enforceReferentialIntegrityOnWrite = HapiProperties.getEnforceReferentialIntegrityOnWrite();
|
private Boolean enforceReferentialIntegrityOnWrite = HapiProperties.getEnforceReferentialIntegrityOnWrite();
|
||||||
@@ -57,13 +58,13 @@ public class FhirServerConfigCommon {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext appContext;
|
private ApplicationContext appContext;
|
||||||
|
|
||||||
public FhirServerConfigCommon() {
|
public FhirServerConfigCommon(AppProperties appProperties) {
|
||||||
ourLog.info("Server configured to " + (this.allowContainsSearches ? "allow" : "deny") + " contains searches");
|
ourLog.info("Server configured to " + (appProperties.getAllow_contains_searches() ? "allow" : "deny") + " contains searches");
|
||||||
ourLog.info("Server configured to " + (this.allowMultipleDelete ? "allow" : "deny") + " multiple deletes");
|
ourLog.info("Server configured to " + (appProperties.getAllow_multiple_delete() ? "allow" : "deny") + " multiple deletes");
|
||||||
ourLog.info("Server configured to " + (this.allowExternalReferences ? "allow" : "deny") + " external references");
|
ourLog.info("Server configured to " + (appProperties.getAllow_external_references() ? "allow" : "deny") + " external references");
|
||||||
ourLog.info("Server configured to " + (this.expungeEnabled ? "enable" : "disable") + " expunges");
|
ourLog.info("Server configured to " + (appProperties.getExpunge_enabled() ? "enable" : "disable") + " expunges");
|
||||||
ourLog.info("Server configured to " + (this.allowPlaceholderReferences ? "allow" : "deny") + " placeholder references");
|
ourLog.info("Server configured to " + (appProperties.getAllow_placeholder_references() ? "allow" : "deny") + " placeholder references");
|
||||||
ourLog.info("Server configured to " + (this.allowOverrideDefaultSearchParams ? "allow" : "deny") + " overriding default search params");
|
ourLog.info("Server configured to " + (appProperties.getAllow_override_default_search_params() ? "allow" : "deny") + " overriding default search params");
|
||||||
|
|
||||||
if (this.emailEnabled) {
|
if (this.emailEnabled) {
|
||||||
ourLog.info("Server is configured to enable email with host '" + this.emailHost + "' and port " + this.emailPort.toString());
|
ourLog.info("Server is configured to enable email with host '" + this.emailHost + "' and port " + this.emailPort.toString());
|
||||||
@@ -91,25 +92,25 @@ public class FhirServerConfigCommon {
|
|||||||
* Configure FHIR properties around the the JPA server via this bean
|
* Configure FHIR properties around the the JPA server via this bean
|
||||||
*/
|
*/
|
||||||
@Bean()
|
@Bean()
|
||||||
public DaoConfig daoConfig() {
|
public DaoConfig daoConfig(AppProperties appProperties) {
|
||||||
DaoConfig retVal = new DaoConfig();
|
DaoConfig retVal = new DaoConfig();
|
||||||
|
|
||||||
retVal.setIndexMissingFields(this.enableIndexMissingFields ? DaoConfig.IndexEnabledEnum.ENABLED : DaoConfig.IndexEnabledEnum.DISABLED);
|
retVal.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? DaoConfig.IndexEnabledEnum.ENABLED : DaoConfig.IndexEnabledEnum.DISABLED);
|
||||||
retVal.setAutoCreatePlaceholderReferenceTargets(this.autoCreatePlaceholderReferenceTargets);
|
retVal.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets());
|
||||||
retVal.setEnforceReferentialIntegrityOnWrite(this.enforceReferentialIntegrityOnWrite);
|
retVal.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
|
||||||
retVal.setEnforceReferentialIntegrityOnDelete(this.enforceReferentialIntegrityOnDelete);
|
retVal.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
|
||||||
retVal.setAllowContainsSearches(this.allowContainsSearches);
|
retVal.setAllowContainsSearches(appProperties.getAllow_contains_searches());
|
||||||
retVal.setAllowMultipleDelete(this.allowMultipleDelete);
|
retVal.setAllowMultipleDelete(appProperties.getAllow_multiple_delete());
|
||||||
retVal.setAllowExternalReferences(this.allowExternalReferences);
|
retVal.setAllowExternalReferences(appProperties.getAllow_external_references());
|
||||||
retVal.setExpungeEnabled(this.expungeEnabled);
|
retVal.setExpungeEnabled(appProperties.getExpunge_enabled());
|
||||||
retVal.setAutoCreatePlaceholderReferenceTargets(this.allowPlaceholderReferences);
|
retVal.setAutoCreatePlaceholderReferenceTargets(appProperties.getAllow_placeholder_references());
|
||||||
retVal.setEmailFromAddress(this.emailFrom);
|
retVal.setEmailFromAddress(this.emailFrom);
|
||||||
|
|
||||||
Integer maxFetchSize = HapiProperties.getMaximumFetchSize();
|
Integer maxFetchSize = appProperties.getMax_page_size();
|
||||||
retVal.setFetchSizeDefaultMaximum(maxFetchSize);
|
retVal.setFetchSizeDefaultMaximum(maxFetchSize);
|
||||||
ourLog.info("Server configured to have a maximum fetch size of " + (maxFetchSize == Integer.MAX_VALUE ? "'unlimited'" : maxFetchSize));
|
ourLog.info("Server configured to have a maximum fetch size of " + (maxFetchSize == Integer.MAX_VALUE ? "'unlimited'" : maxFetchSize));
|
||||||
|
|
||||||
Long reuseCachedSearchResultsMillis = HapiProperties.getReuseCachedSearchResultsMillis();
|
Long reuseCachedSearchResultsMillis = appProperties.getReuse_cached_search_results_millis();
|
||||||
retVal.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsMillis);
|
retVal.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsMillis);
|
||||||
ourLog.info("Server configured to cache search results for {} milliseconds", reuseCachedSearchResultsMillis);
|
ourLog.info("Server configured to cache search results for {} milliseconds", reuseCachedSearchResultsMillis);
|
||||||
|
|
||||||
@@ -149,11 +150,11 @@ public class FhirServerConfigCommon {
|
|||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ModelConfig modelConfig() {
|
public ModelConfig modelConfig(AppProperties appProperties) {
|
||||||
ModelConfig modelConfig = new ModelConfig();
|
ModelConfig modelConfig = new ModelConfig();
|
||||||
modelConfig.setAllowContainsSearches(this.allowContainsSearches);
|
modelConfig.setAllowContainsSearches(appProperties.getAllow_contains_searches());
|
||||||
modelConfig.setAllowExternalReferences(this.allowExternalReferences);
|
modelConfig.setAllowExternalReferences(appProperties.getAllow_external_references());
|
||||||
modelConfig.setDefaultSearchParamsCanBeOverridden(this.allowOverrideDefaultSearchParams);
|
modelConfig.setDefaultSearchParamsCanBeOverridden(appProperties.getAllow_override_default_search_params());
|
||||||
modelConfig.setEmailFromAddress(this.emailFrom);
|
modelConfig.setEmailFromAddress(this.emailFrom);
|
||||||
|
|
||||||
// You can enable these if you want to support Subscriptions from your server
|
// You can enable these if you want to support Subscriptions from your server
|
||||||
@@ -174,7 +175,7 @@ public class FhirServerConfigCommon {
|
|||||||
* <p>
|
* <p>
|
||||||
* A URL to a remote database could also be placed here, along with login credentials and other properties supported by BasicDataSource.
|
* A URL to a remote database could also be placed here, along with login credentials and other properties supported by BasicDataSource.
|
||||||
*/
|
*/
|
||||||
@Bean(destroyMethod = "close")
|
/*@Bean(destroyMethod = "close")
|
||||||
public BasicDataSource dataSource() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
|
public BasicDataSource dataSource() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
|
||||||
BasicDataSource retVal = new BasicDataSource();
|
BasicDataSource retVal = new BasicDataSource();
|
||||||
Driver driver = (Driver) Class.forName(HapiProperties.getDataSourceDriver()).getConstructor().newInstance();
|
Driver driver = (Driver) Class.forName(HapiProperties.getDataSourceDriver()).getConstructor().newInstance();
|
||||||
@@ -184,7 +185,7 @@ public class FhirServerConfigCommon {
|
|||||||
retVal.setPassword(HapiProperties.getDataSourcePassword());
|
retVal.setPassword(HapiProperties.getDataSourcePassword());
|
||||||
retVal.setMaxTotal(HapiProperties.getDataSourceMaxPoolSize());
|
retVal.setMaxTotal(HapiProperties.getDataSourceMaxPoolSize());
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ca.uhn.fhir.context.ConfigurationException;
|
|||||||
import ca.uhn.fhir.jpa.config.BaseJavaConfigR4;
|
import ca.uhn.fhir.jpa.config.BaseJavaConfigR4;
|
||||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
@@ -16,6 +17,7 @@ import javax.sql.DataSource;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile("r4")
|
@Profile("r4")
|
||||||
|
@ConditionalOnClass(DataSource.class)
|
||||||
public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package ca.uhn.fhir.jpa.starter;
|
package ca.uhn.fhir.jpa.starter;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.to.FhirTesterMvcConfig;
|
import ca.uhn.fhir.to.FhirTesterMvcConfig;
|
||||||
import ca.uhn.fhir.to.TesterConfig;
|
import ca.uhn.fhir.to.TesterConfig;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
/**
|
/**
|
||||||
@@ -35,15 +34,15 @@ public class FhirTesterConfig {
|
|||||||
* you might want to use that instead of using the variable.
|
* you might want to use that instead of using the variable.
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public TesterConfig testerConfig() {
|
public TesterConfig testerConfig(AppProperties appProperties) {
|
||||||
TesterConfig retVal = new TesterConfig();
|
TesterConfig retVal = new TesterConfig();
|
||||||
retVal
|
retVal
|
||||||
.addServer()
|
.addServer()
|
||||||
.withId(HapiProperties.getServerId())
|
.withId(appProperties.getTester().getId())
|
||||||
.withFhirVersion(HapiProperties.getFhirVersion())
|
.withFhirVersion(appProperties.getFhir_version())
|
||||||
.withBaseUrl(HapiProperties.getServerAddress())
|
.withBaseUrl(appProperties.getTester().getAddress())
|
||||||
.withName(HapiProperties.getServerName());
|
.withName(appProperties.getTester().getName());
|
||||||
retVal.setRefuseToFetchThirdPartyUrls(HapiProperties.getTesterConfigRefustToFetchThirdPartyUrls());
|
retVal.setRefuseToFetchThirdPartyUrls(appProperties.getTester().getRefuse_to_fetch_third_party_urls());
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: 'jdbc:h2:file:./target/database/h2'
|
url: 'jdbc:h2:file:./target/database/h2dflkjglkj'
|
||||||
username: sa
|
username: sa
|
||||||
password:
|
password:
|
||||||
driverClassName: org.h2.Driver
|
driverClassName: org.h2.Driver
|
||||||
@@ -39,14 +39,14 @@ hapi:
|
|||||||
max_page_size: 200
|
max_page_size: 200
|
||||||
retain_cached_searches_mins: 60
|
retain_cached_searches_mins: 60
|
||||||
reuse_cached_search_results_millis: 60000
|
reuse_cached_search_results_millis: 60000
|
||||||
server:
|
tester:
|
||||||
id: home
|
id: home
|
||||||
name: Local Tester
|
name: Local Tester
|
||||||
server_address: 'http://localhost:8080/fhir'
|
server_address: 'http://localhost:8080/fhir'
|
||||||
refuse_to_fetch_third_party_urls: false
|
refuse_to_fetch_third_party_urls: false
|
||||||
validation:
|
validation:
|
||||||
requests_enabled: false
|
requests_enabled: true
|
||||||
responses_enabled: false
|
responses_enabled: true
|
||||||
|
|
||||||
binary_storage_enabled: true
|
binary_storage_enabled: true
|
||||||
bulk_export_enabled: true
|
bulk_export_enabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user