13
README.md
13
README.md
@@ -50,3 +50,16 @@ The UI is customized using [Thymeleaf](https://www.thymeleaf.org/) template file
|
|||||||
|
|
||||||
Several template files that can be customized are found in the following directory: [https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates)
|
Several template files that can be customized are found in the following directory: [https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates)
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
Much of this HAPI starter project can be configured using the properties file in *src/main/resources/hapi.properties*. By default, this starter project is configured to use Derby as the database.
|
||||||
|
|
||||||
|
## MySql
|
||||||
|
|
||||||
|
To configure the starter app to use MySQL, instead of the default Derby, update the hapi.properties file to have the following:
|
||||||
|
|
||||||
|
* datasource.driver=com.mysql.jdbc.Driver
|
||||||
|
* datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3
|
||||||
|
* hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
|
||||||
|
|
||||||
|
It is important to use MySQL5Dialect when using MySQL version 5+.
|
||||||
@@ -24,25 +24,43 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
|
|||||||
@EnableTransactionManagement()
|
@EnableTransactionManagement()
|
||||||
public class FhirServerConfigCommon {
|
public class FhirServerConfigCommon {
|
||||||
|
|
||||||
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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() {
|
||||||
DaoConfig retVal = new DaoConfig();
|
DaoConfig retVal = new DaoConfig();
|
||||||
retVal.setAllowMultipleDelete(HapiProperties.getAllowMultipleDelete());
|
|
||||||
retVal.setAllowExternalReferences(HapiProperties.getAllowExternalReferences());
|
|
||||||
retVal.setExpungeEnabled(HapiProperties.getExpungeEnabled());
|
|
||||||
|
|
||||||
|
Boolean allowMultipleDelete = HapiProperties.getAllowMultipleDelete();
|
||||||
|
retVal.setAllowMultipleDelete(allowMultipleDelete);
|
||||||
|
ourLog.info("Server configured to " + (allowMultipleDelete ? "allow" : "deny") + " multiple deletes");
|
||||||
|
|
||||||
|
Boolean allowExternalReferences = HapiProperties.getAllowExternalReferences();
|
||||||
|
retVal.setAllowExternalReferences(allowExternalReferences);
|
||||||
|
ourLog.info("Server configured to " + (allowExternalReferences ? "allow" : "deny") + " external references");
|
||||||
|
|
||||||
|
Boolean expungeEnabled = HapiProperties.getExpungeEnabled();
|
||||||
|
retVal.setExpungeEnabled(expungeEnabled);
|
||||||
|
ourLog.info("Server configured to " + (expungeEnabled ? "enable" : "disable") + " expunges");
|
||||||
|
|
||||||
|
Boolean allowPlaceholderReferences = HapiProperties.getAllowPlaceholderReferences();
|
||||||
|
retVal.setAutoCreatePlaceholderReferenceTargets(allowPlaceholderReferences);
|
||||||
|
ourLog.info("Server configured to " + (allowPlaceholderReferences ? "allow" : "deny") + " placeholder references");
|
||||||
|
|
||||||
// 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
|
||||||
if (false) {
|
if (HapiProperties.getSubscriptionRestHookEnabled()) {
|
||||||
|
ourLog.info("Enabling REST-hook subscriptions");
|
||||||
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
|
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
|
||||||
}
|
}
|
||||||
if (false) {
|
|
||||||
|
if (HapiProperties.getSubscriptionEmailEnabled()) {
|
||||||
|
ourLog.info("Enabling email subscriptions");
|
||||||
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
|
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class FhirTesterConfig {
|
|||||||
.addServer()
|
.addServer()
|
||||||
.withId(HapiProperties.getServerId())
|
.withId(HapiProperties.getServerId())
|
||||||
.withFhirVersion(HapiProperties.getFhirVersion())
|
.withFhirVersion(HapiProperties.getFhirVersion())
|
||||||
.withBaseUrl("${serverBase}" + HapiProperties.getServerBase())
|
.withBaseUrl(HapiProperties.getServerAddress())
|
||||||
.withName(HapiProperties.getServerName());
|
.withName(HapiProperties.getServerName());
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,32 +10,36 @@ import java.io.InputStream;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class HapiProperties {
|
public class HapiProperties {
|
||||||
public static final String SERVER_ADDRESS = "server_address";
|
static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references";
|
||||||
public static final String DEFAULT_PRETTY_PRINT = "default_pretty_print";
|
static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete";
|
||||||
public static final String MAX_PAGE_SIZE = "max_page_size";
|
static final String ALLOW_PLACEHOLDER_REFERENCES = "allow_placeholder_references";
|
||||||
public static final String DEFAULT_PAGE_SIZE = "default_page_size";
|
static final String DATASOURCE_DRIVER = "datasource.driver";
|
||||||
public static final String LOGGER_NAME = "logger.name";
|
static final String DATASOURCE_PASSWORD = "datasource.password";
|
||||||
public static final String LOGGER_FORMAT = "logger.format";
|
static final String DATASOURCE_URL = "datasource.url";
|
||||||
public static final String ALLOW_EXTERNAL_REFERENCES = "allow_external_references";
|
static final String DATASOURCE_USERNAME = "datasource.username";
|
||||||
public static final String ALLOW_MULTIPLE_DELETE = "allow_multiple_delete";
|
static final String DEFAULT_ENCODING = "default_encoding";
|
||||||
public static final String DATASOURCE_PASSWORD = "datasource.password";
|
static final String DEFAULT_PAGE_SIZE = "default_page_size";
|
||||||
public static final String DATASOURCE_USERNAME = "datasource.username";
|
static final String DEFAULT_PRETTY_PRINT = "default_pretty_print";
|
||||||
public static final String DATASOURCE_URL = "datasource.url";
|
static final String ETAG_SUPPORT = "etag_support";
|
||||||
public static final String DATASOURCE_DRIVER = "datasource.driver";
|
|
||||||
public static final String LOGGER_LOG_EXCEPTIONS = "logger.log_exceptions";
|
|
||||||
public static final String LOGGER_ERROR_FORMAT = "logger.error_format";
|
|
||||||
public static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name";
|
|
||||||
public static final String SERVER_BASE = "server.base";
|
|
||||||
public static final String TEST_PORT = "test.port";
|
|
||||||
public static final String SERVER_NAME = "server.name";
|
|
||||||
public static final String SERVER_ID = "server.id";
|
|
||||||
private static final String HAPI_PROPERTIES = "hapi.properties";
|
|
||||||
static final String FHIR_VERSION = "fhir_version";
|
static final String FHIR_VERSION = "fhir_version";
|
||||||
private static final String DEFAULT_ENCODING = "default_encoding";
|
static final String HAPI_PROPERTIES = "hapi.properties";
|
||||||
private static final String ETAG_SUPPORT = "etag_support";
|
static final String LOGGER_ERROR_FORMAT = "logger.error_format";
|
||||||
|
static final String LOGGER_FORMAT = "logger.format";
|
||||||
|
static final String LOGGER_LOG_EXCEPTIONS = "logger.log_exceptions";
|
||||||
|
static final String LOGGER_NAME = "logger.name";
|
||||||
|
static final String MAX_PAGE_SIZE = "max_page_size";
|
||||||
|
static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name";
|
||||||
|
static final String SERVER_ADDRESS = "server_address";
|
||||||
|
static final String SERVER_BASE = "server.base";
|
||||||
|
static final String SERVER_ID = "server.id";
|
||||||
|
static final String SERVER_NAME = "server.name";
|
||||||
|
static final String SUBSCRIPTION_EMAIL_ENABLED = "subscription.email.enabled";
|
||||||
|
static final String SUBSCRIPTION_RESTHOOK_ENABLED = "subscription.resthook.enabled";
|
||||||
|
static final String TEST_PORT = "test.port";
|
||||||
|
|
||||||
private static Properties properties;
|
private static Properties properties;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Force the configuration to be reloaded
|
* Force the configuration to be reloaded
|
||||||
*/
|
*/
|
||||||
public static void forceReload() {
|
public static void forceReload() {
|
||||||
@@ -219,4 +223,16 @@ public class HapiProperties {
|
|||||||
public static String getServerId() {
|
public static String getServerId() {
|
||||||
return HapiProperties.getProperty(SERVER_ID, "home");
|
return HapiProperties.getProperty(SERVER_ID, "home");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Boolean getAllowPlaceholderReferences() {
|
||||||
|
return HapiProperties.getBooleanProperty(ALLOW_PLACEHOLDER_REFERENCES, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSubscriptionEmailEnabled() {
|
||||||
|
return HapiProperties.getBooleanProperty(SUBSCRIPTION_EMAIL_ENABLED, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSubscriptionRestHookEnabled() {
|
||||||
|
return HapiProperties.getBooleanProperty(SUBSCRIPTION_RESTHOOK_ENABLED, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ default_page_size=20
|
|||||||
max_page_size=200
|
max_page_size=200
|
||||||
allow_multiple_delete=true
|
allow_multiple_delete=true
|
||||||
allow_external_references=true
|
allow_external_references=true
|
||||||
|
allow_placeholder_references=true
|
||||||
expunge_enabled=true
|
expunge_enabled=true
|
||||||
persistence_unit_name=HAPI_PU
|
persistence_unit_name=HAPI_PU
|
||||||
logger.name=fhirtest.access
|
logger.name=fhirtest.access
|
||||||
@@ -31,7 +32,8 @@ datasource.password=
|
|||||||
server.name=Local Tester
|
server.name=Local Tester
|
||||||
server.id=home
|
server.id=home
|
||||||
test.port=
|
test.port=
|
||||||
|
subscription.email.enabled=true
|
||||||
|
subscription.resthook.enabled=true
|
||||||
hibernate.dialect=ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect
|
hibernate.dialect=ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect
|
||||||
hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory
|
hibernate.search.model_mapping=ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory
|
||||||
hibernate.format_sql=false
|
hibernate.format_sql=false
|
||||||
|
|||||||
Reference in New Issue
Block a user