Skip to content

Commit 2a93187

Browse files
committed
#663 - Standardized API endpoint to serve configuration for the frontend
- Add SettingsController and /.settings endpoint - add some passthrough config params to application.yml
1 parent 971b3e1 commit 2a93187

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

src/main/java/de/numcodex/feasibility_gui_backend/config/WebSecurityConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class WebSecurityConfig {
5151
public static final String PATH_CODEABLE_CONCEPT = "/codeable-concept";
5252
public static final String PATH_SWAGGER_UI = "/swagger-ui/**";
5353
public static final String PATH_SWAGGER_CONFIG = "/v3/api-docs/**";
54+
public static final String PATH_SETTINGS = "/.settings";
5455
@Value("${app.keycloakAllowedRole}")
5556
private String keycloakAllowedRole;
5657

@@ -97,6 +98,7 @@ public SecurityFilterChain apiFilterChain(
9798
Converter<Jwt, ? extends AbstractAuthenticationToken> authenticationConverter) throws Exception {
9899

99100
http.authorizeHttpRequests(authorize -> authorize
101+
.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(PATH_SETTINGS)).permitAll()
100102
.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(PATH_SWAGGER_CONFIG)).permitAll()
101103
.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(PATH_API + PATH_ACTUATOR_HEALTH)).permitAll()
102104
.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(PATH_API + PATH_ACTUATOR_INFO)).permitAll()
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package de.numcodex.feasibility_gui_backend.settings;
2+
3+
import java.util.Map;
4+
5+
import de.numcodex.feasibility_gui_backend.config.WebSecurityConfig;
6+
import lombok.extern.slf4j.Slf4j;
7+
import org.springframework.beans.factory.annotation.Value;
8+
import org.springframework.web.bind.annotation.CrossOrigin;
9+
import org.springframework.web.bind.annotation.GetMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
@RestController
13+
@Slf4j
14+
@CrossOrigin(origins = "${cors.allowedOrigins}", exposedHeaders = "Location")
15+
public class SettingsController {
16+
17+
private static final String KEY_DSE_URL = "dsePatientProfileUrl";
18+
private static final String KEY_LOCATION_RESULT_LOWERBOUNDARY = "lowerboundarylocationresult";
19+
private static final String KEY_PATIENT_RESULT_LOWERBOUNDARY = "lowerboundarypatientresult";
20+
private static final String KEY_POLLING_INTERVAL = "pollingintervall";
21+
private static final String KEY_POLLING_TIME = "pollingtime";
22+
private static final String KEY_PORTAL_LINK = "proposalPortalLink";
23+
private static final String KEY_CCDL_VERSION = "ccdlVersion";
24+
private static final String KEY_REST_API_PATH = "uiBackendApiUrl";
25+
26+
27+
@Value("${app.guiInfo.dsePatientProfileUrl}")
28+
private String dseUrl;
29+
30+
@Value("${app.privacy.threshold.sites}")
31+
private String lowerboundaryLocationResult;
32+
33+
@Value("${app.privacy.threshold.results}")
34+
private String lowerboundardyPatientResult;
35+
36+
@Value("${app.privacy.quota.read.resultDetailedObfuscated.interval}")
37+
private String pollingInterval;
38+
39+
@Value("${app.privacy.quota.read.resultSummary.pollingInterval}")
40+
private String pollingTime = "PT20S";
41+
42+
@Value("${app.guiInfo.portalLink}")
43+
private String portalLink;
44+
45+
@Value("${app.guiInfo.ccdlVersion}")
46+
private String ccdlVersion = "version";
47+
48+
49+
@GetMapping("/.settings")
50+
public Map<String, String> getSettings() {
51+
return Map.of(
52+
KEY_DSE_URL, dseUrl,
53+
KEY_LOCATION_RESULT_LOWERBOUNDARY, lowerboundaryLocationResult,
54+
KEY_PATIENT_RESULT_LOWERBOUNDARY, lowerboundardyPatientResult,
55+
KEY_POLLING_INTERVAL, pollingInterval,
56+
KEY_POLLING_TIME, pollingTime,
57+
KEY_PORTAL_LINK, portalLink,
58+
KEY_CCDL_VERSION, ccdlVersion,
59+
KEY_REST_API_PATH, WebSecurityConfig.PATH_API
60+
);
61+
}
62+
}

src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ app:
7373
queryResultExpiry: ${QUERYRESULT_EXPIRY:PT1M}
7474
maxSavedQueriesPerUser: ${MAX_SAVED_QUERIES_PER_USER:10}
7575
purgeExpiredQueries: ${PURGE_EXPIRED_QUERIES:0 0 * * * *}
76+
guiInfo:
77+
ccdlVersion: ${CCDL_VERSION:unknown}
78+
portalLink: ${PORTAL_LINK:https://antrag.forschen-fuer-gesundheit.de}
79+
dsePatientProfileUrl: ${DSE_PATIENT_PROFILE_URL:https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/PatientPseudonymisiert}
7680
export:
7781
csv:
7882
delimiter: ${EXPORT_CSV_DELIMITER:;}

0 commit comments

Comments
 (0)