Feature/static files (#456)

* Added mapping

* Added documentation
This commit is contained in:
Jens Kristian Villadsen
2023-01-05 23:26:09 +01:00
committed by GitHub
parent 9a513cd184
commit 96ff27f173
3 changed files with 37 additions and 0 deletions

View File

@@ -72,6 +72,8 @@ public class AppProperties {
private Boolean install_transitive_ig_dependencies = true; private Boolean install_transitive_ig_dependencies = true;
private Map<String, ImplementationGuide> implementationGuides = null; private Map<String, ImplementationGuide> implementationGuides = null;
private String staticLocation = null;
private Boolean lastn_enabled = false; private Boolean lastn_enabled = false;
private boolean store_resource_in_lucene_index_enabled = false; private boolean store_resource_in_lucene_index_enabled = false;
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED; private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
@@ -89,6 +91,16 @@ public class AppProperties {
return custom_interceptor_classes; return custom_interceptor_classes;
} }
public String getStaticLocation() {
return staticLocation;
}
public void setStaticLocation(String staticLocation) {
this.staticLocation = staticLocation;
}
public Boolean getOpenapi_enabled() { public Boolean getOpenapi_enabled() {
return openapi_enabled; return openapi_enabled;
} }

View File

@@ -0,0 +1,22 @@
package ca.uhn.fhir.jpa.starter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@ConditionalOnProperty(prefix = "hapi.fhir", name = "staticLocation")
public class ExtraStaticFilesConfigurer implements WebMvcConfigurer {
@Autowired
AppProperties appProperties;
@Override
public void addResourceHandlers(ResourceHandlerRegistry theRegistry) {
theRegistry
.addResourceHandler("/static/**")
.addResourceLocations(appProperties.getStaticLocation());
}
}

View File

@@ -52,6 +52,7 @@ spring:
# hibernate.search.backend.analysis.configurer: ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers$HapiElasticAnalysisConfigurer # hibernate.search.backend.analysis.configurer: ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers$HapiElasticAnalysisConfigurer
hapi: hapi:
fhir: fhir:
### This enables the swagger-ui at /fhir/swagger-ui/index.html as well as the /fhir/api-docs (see https://hapifhir.io/hapi-fhir/docs/server_plain/openapi.html) ### This enables the swagger-ui at /fhir/swagger-ui/index.html as well as the /fhir/api-docs (see https://hapifhir.io/hapi-fhir/docs/server_plain/openapi.html)
openapi_enabled: true openapi_enabled: true
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5 ### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
@@ -62,6 +63,8 @@ hapi:
### forces the use of the https:// protocol for the returned server address. ### forces the use of the https:// protocol for the returned server address.
### alternatively, it may be set using the X-Forwarded-Proto header. ### alternatively, it may be set using the X-Forwarded-Proto header.
# use_apache_address_strategy_https: false # use_apache_address_strategy_https: false
### enables the server to host content like HTML, css, etc. under the url pattern of /static/**
# staticLocation: file:/usr/somewhere/
### enable to set the Server URL ### enable to set the Server URL
# server_address: http://hapi.fhir.org/baseR4 # server_address: http://hapi.fhir.org/baseR4
# defer_indexing_for_codesystems_of_size: 101 # defer_indexing_for_codesystems_of_size: 101