|
| 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 | +} |
0 commit comments