diff --git a/.gitignore b/.gitignore index 8f3cfbc9..c1819e73 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ hs_err_pid* **/org.eclipse* **/.classpath dpppt-config-backend/.sts4-cache/classpath-data.json + +dpppt-config-backend/dp3t-config-ws.log.1 diff --git a/README.md b/README.md index 1502f42f..9c74ede1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ -# dp3t-config-backend-ch +# SwissCovid Config Backend + +SwissCovid is the official contact tracing app of Switzerland. The app can be installed from the [App Store](https://apps.apple.com/ch/app/swisscovid/id1509275381) or the [Google Play Store](https://play.google.com/store/apps/details?id=ch.admin.bag.dp3t). The SwissCovid 2.0 app uses two types of contact tracing to prevent the spread of COVID-19. + +With proximity tracing close contacts are detected using the bluetooth technology. For this the [dp3t-sdk-backend](https://github.com/DP-3T/dp3t-sdk-backend), [DP3T iOS SDK](https://github.com/DP-3T/dp3t-sdk-ios) and [DP3T Android SDK](https://github.com/DP-3T/dp3t-sdk-android) are used that build on top of the Google & Apple Exposure Notifications. This feature is called SwissCovid encounters. + +With presence tracing people that are at the same venue at the same time are detected. For this the [swisscovid-cn-backend](https://github.com/SwissCovid/swisscovid-cn-backend), [CrowdNotifier iOS SDK](https://github.com/CrowdNotifier/crowdnotifier-sdk-ios) and [CrowdNotifier Android SDK](https://github.com/CrowdNotifier/crowdnotifier-sdk-android) are used that provide a secure, decentralized, privacy-preserving presence tracing system. This feature is called SwissCovid Check-in. + +## Description This backend is used by the apps to get their config every 6h. It is used by the Swiss Government to update the epidemiological parameters if needed. @@ -44,3 +52,23 @@ The call to `/v1/config` does the following special actions: 1. `If iOS == 13.6`: warn that the German 'no risk' message is misleading 1. `If App == Testflight`: warn that the app should be updated to the official app-store app 1. `If App == Initial iOS test app`: set `factorHigh` = `0` to avoid errors + +## Repositories + +- Android App: [swisscovid-app-android](https://github.com/SwissCovid/swisscovid-app-android) +- iOS App: [swisscovid-app-ios](https://github.com/SwissCovid/swisscovid-app-ios) +- CovidCode Web-App: [CovidCode-UI](https://github.com/admin-ch/CovidCode-UI) +- CovidCode Backend: [CovidCode-Service](https://github.com/admin-ch/CovidCode-service) +- Config Backend: [swisscovid-config-backend](https://github.com/SwissCovid/swisscovid-config-backend) +- Additional Info Backend: [swisscovid-additionalinfo-backend](https://github.com/SwissCovid/swisscovid-additionalinfo-backend) +- QR Code Landingpage: [swisscovid-qr-landingpage](https://github.com/SwissCovid/swisscovid-qr-landingpage) +- DP3T Android SDK & Calibration app: [dp3t-sdk-android](https://github.com/DP-3T/dp3t-sdk-android) +- DP3T iOS SDK & Calibration app: [dp3t-sdk-ios](https://github.com/DP-3T/dp3t-sdk-ios) +- DP3T Backend SDK: [dp3t-sdk-backend](https://github.com/DP-3T/dp3t-sdk-backend) +- CrowdNotifier Android SDK: [crowdnotifier-sdk-android](https://github.com/CrowdNotifier/crowdnotifier-sdk-android) +- CrowdNotifier iOS SDK: [crowdnotifier-sdk-ios](https://github.com/CrowdNotifier/crowdnotifier-sdk-ios) +- CrowdNotifier Backend: [swisscovid-cn-backend](https://github.com/SwissCovid/swisscovid-cn-backend) + +## License + +This project is licensed under the terms of the MPL 2 license. See the [LICENSE](LICENSE) file. diff --git a/dpppt-config-backend/pom.xml b/dpppt-config-backend/pom.xml index 2c4f215d..ff8a08f1 100644 --- a/dpppt-config-backend/pom.xml +++ b/dpppt-config-backend/pom.xml @@ -9,135 +9,135 @@ --> - 4.0.0 + 4.0.0 - org.dpppt.switzerland - dpppt-config-backend - jar - 1.0.15-SNAPSHOT - DP3T Config Backend + org.dpppt.switzerland + dpppt-config-backend + jar + 2.0.1-SNAPSHOT + DP3T Config Backend - - 11 - UTF-8 - 2.3.7.RELEASE - - 1.9.1 - + + 11 + UTF-8 + 2.5.4 + + 1.9.1 + - - - ch.ubique.openapi - doc-annotations - 1.0.4 - - - - org.springframework - spring-context - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-starter-actuator - - - io.micrometer - micrometer-registry-prometheus - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - org.springframework.boot - spring-boot-starter-validation - + + + ch.ubique.openapi + doc-annotations + 1.0.4 + + + + org.springframework + spring-context + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + + + io.micrometer + micrometer-registry-prometheus + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.springframework.boot + spring-boot-starter-validation + + + + io.jsonwebtoken + jjwt-api + 0.11.1 + + + io.jsonwebtoken + jjwt-root + 0.11.1 + pom + - - io.jsonwebtoken - jjwt-api - 0.11.1 - - - io.jsonwebtoken - jjwt-root - 0.11.1 - pom - - - - io.jsonwebtoken - jjwt-jackson - 0.11.1 - runtime - + + io.jsonwebtoken + jjwt-jackson + 0.11.1 + runtime + - - io.jsonwebtoken - jjwt-impl - 0.11.1 - runtime - + + io.jsonwebtoken + jjwt-impl + 0.11.1 + runtime + - - org.bouncycastle - bcpkix-jdk15on - 1.65 - - - - junit - junit - test - + + org.bouncycastle + bcpkix-jdk15on + 1.65 + + + + junit + junit + test + - - - org.slf4j - slf4j-api - - - org.slf4j - jcl-over-slf4j - - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - - org.springframework.boot - spring-boot-starter-test - test + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + + ch.qos.logback + logback-core + + + ch.qos.logback + logback-classic + + + ch.admin.bag.covidcertificate + cc-backend-logging + 1.0.0 + + + + org.springframework.boot + spring-boot-starter-test + test @@ -157,269 +157,270 @@ spring-security-web + + + + + + org.springframework.boot + spring-boot-dependencies + pom + ${spring-boot-version} + import + + + + + + spring-snapshots + Spring Snapshots + http://repo.spring.io/snapshot + + true + + + - - - - org.springframework.boot - spring-boot-dependencies - pom - ${spring-boot-version} - import - - - + + + dpppt-config-backend + + + + org.springframework.boot + spring-boot-maven-plugin + + org.dpppt.switzerland.backend.sdk.config.ws.Application + + + + + repackage + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java-version} + ${java-version} + + -parameters + + + + + + pl.project13.maven + git-commit-id-plugin + + + retrieve-git-info + prepare-package + + revision + + + + + true + true + false + yyyyMMddHHmmss + UTC + + - - - spring-snapshots - Spring Snapshots - http://repo.spring.io/snapshot - - true - - - + + org.apache.maven.plugins + maven-jar-plugin + + + + ${git.commit.id} + ${git.commit.time} + true + + + + - - - dpppt-config-backend - - - - org.springframework.boot - spring-boot-maven-plugin - 2.2.6.RELEASE - - org.dpppt.switzerland.backend.sdk.config.ws.Application - - - - - repackage - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java-version} - ${java-version} - - -parameters - - - - - - pl.project13.maven - git-commit-id-plugin - - - retrieve-git-info - prepare-package - - revision - - - - - true - true - false - yyyyMMddHHmmss - UTC - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - ${git.commit.id} - ${git.commit.time} - true - - - - - - - io.github.zlika - reproducible-build-maven-plugin - 0.12 - - - strip-jaxb - - strip-jaxb - - - - strip-jar - - strip-jar - - - ${git.commit.time} - - - - - - + + io.github.zlika + reproducible-build-maven-plugin + 0.12 + + + strip-jaxb + + strip-jaxb + + + + strip-jar + + strip-jar + + + ${git.commit.time} + + + + + + - - ch.ubique.openapi - springboot-swagger-3 - 1.3.3 - - 1.0-gapple - - org.dpppt.switzerland.backend.sdk.config.ws.model - - - com.google.protobuf - - - byte - - - org.dpppt.switzerland.backend.sdk.config.ws.controller.DPPPTConfigController - - DP3T API - - https://demo.dpppt.org - - DP3T API - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ch.ubique.openapi + springboot-swagger-3 + 1.3.3 + + 1.0-gapple + + org.dpppt.switzerland.backend.sdk.config.ws.model + + + com.google.protobuf + + + byte + + + + org.dpppt.switzerland.backend.sdk.config.ws.controller.DPPPTConfigController + + + DP3T API + + https://demo.dpppt.org + + DP3T API + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + diff --git a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/Application.java b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/Application.java index 8b85fa53..6ac95e15 100644 --- a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/Application.java +++ b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/Application.java @@ -17,13 +17,15 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; @Configuration -@ComponentScan(basePackages = {"org.dpppt.switzerland.backend.sdk.config.ws.config"}) +@ComponentScan(basePackages = {"org.dpppt.switzerland.backend.sdk.config.ws.config", + "ch.admin.bag.covidcertificate.log", + "ch.admin.bag.covidcertificate.rest"}) @EnableAutoConfiguration @EnableWebMvc public class Application { - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } } diff --git a/dpppt-config-backend/src/main/resources/application-local.properties b/dpppt-config-backend/src/main/resources/application-local.properties new file mode 100644 index 00000000..b81e446d --- /dev/null +++ b/dpppt-config-backend/src/main/resources/application-local.properties @@ -0,0 +1 @@ +logging.config=classpath:local-logback.xml \ No newline at end of file diff --git a/dpppt-config-backend/src/main/resources/application.properties b/dpppt-config-backend/src/main/resources/application.properties index db49b6fa..aa0c3545 100644 --- a/dpppt-config-backend/src/main/resources/application.properties +++ b/dpppt-config-backend/src/main/resources/application.properties @@ -8,8 +8,9 @@ # SPDX-License-Identifier: MPL-2.0 # -spring.profiles.active=cloud-dev +spring.profiles.active=cloud-dev,local +spring.application.name=dp3t-config-service server.port=8080 management.endpoints.enabled-by-default=false vcap.services.ecdsa_cs_dev.credentials.privateKey=LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR0VBZ0VBTUJBR0J5cUdTTTQ5QWdFR0JTdUJCQUFLQkcwd2F3SUJBUVFnMkRsai9lNW5rRlBtTk1MVjd1NjQKenFuOHdSeVgrUTgyc045RDRSWXlvNjJoUkFOQ0FBVGFzRmgwR0tlazVZNEp1d2dpNUg4QWsvcWZqa0pDd3o3UApYb0lVZWJnaXN5N1RWUUxySW1CUFU3aWcwMzdrMGRvVXhrK1hkQktYNDN2L3JkR1lVS2YxCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K -vcap.services.ecdsa_cs_dev.credentials.publicKey=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNTRENDQWU2Z0F3SUJBZ0lVS3pEQlJIZlZVN2djRGZxUTBGUDFLTkJULzVJd0NnWUlLb1pJemowRUF3SXcKZXpFTE1Ba0dBMVVFQmhNQ1EwZ3hEVEFMQmdOVkJBZ01CRUpsY200eERUQUxCZ05WQkFjTUJFSmxjbTR4RERBSwpCZ05WQkFvTUEwSkpWREVNTUFvR0ExVUVDd3dEUlZkS01RMHdDd1lEVlFRRERBUlVaWE4wTVNNd0lRWUpLb1pJCmh2Y05BUWtCRmhSemRYQndiM0owUUdKcGRDNWhaRzFwYmk1amFEQWVGdzB5TURBME1qZ3hNakUwTlRGYUZ3MHkKTVRBME1qZ3hNakUwTlRGYU1Ic3hDekFKQmdOVkJBWVRBa05JTVEwd0N3WURWUVFJREFSQ1pYSnVNUTB3Q3dZRApWUVFIREFSQ1pYSnVNUXd3Q2dZRFZRUUtEQU5DU1ZReEREQUtCZ05WQ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hNakUwTlRGYU1Ic3hDekFKQmdOVkJBWVRBa05JTVEwd0N3WURWUVFJREFSQ1pYSnVNUTB3Q3dZRApWUVFIREFSQ1pYSnVNUXd3Q2dZRFZRUUtEQU5DU1ZReEREQUtCZ05WQkFzTUEwVlhTakVOTUFzR0ExVUVBd3dFClZHVnpkREVqTUNFR0NTcUdTSWIzRFFFSkFSWVVjM1Z3Y0c5eWRFQmlhWFF1WVdSdGFXNHVZMmd3VmpBUUJnY3EKaGtqT1BRSUJCZ1VyZ1FRQUNnTkNBQVRhc0ZoMEdLZWs1WTRKdXdnaTVIOEFrL3FmamtKQ3d6N1BYb0lVZWJnaQpzeTdUVlFMckltQlBVN2lnMDM3azBkb1V4aytYZEJLWDQzdi9yZEdZVUtmMW8xTXdVVEFkQmdOVkhRNEVGZ1FVCnVTS2lWSUdsRnpQdDdXd3Z1VGNicDNrckQ0UXdId1lEVlIwakJCZ3dGb0FVdVNLaVZJR2xGelB0N1d3dnVUY2IKcDNrckQ0UXdEd1lEVlIwVEFRSC9CQVV3QXdFQi96QUtCZ2dxaGtqT1BRUURBZ05JQURCRkFpQkRteEJUQ3BZawphN0hFeUFEWnN4d3p3b2h0TjBwNTd5QllMYjZzQ3B3ODhBSWhBSXpTUDdCV0tGWmNDSmI5ZmhwcjZaTXpJd0tlCkhhSWpIK2E4elV2Nk1PaW8KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= diff --git a/dpppt-config-backend/src/main/resources/local-logback.xml b/dpppt-config-backend/src/main/resources/local-logback.xml new file mode 100644 index 00000000..8b1a8d6c --- /dev/null +++ b/dpppt-config-backend/src/main/resources/local-logback.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + DEBUG + + + ${CONSOLE_LOG_PATTERN} + utf8 + + + + + + ${LOG_FILE}.log + + ${LOG_FILE}.%d{yyyy-MM-dd}.gz + 7 + + + ${CONSOLE_LOG_PATTERN} + utf8 + + + 512KB + + + + + + + + + \ No newline at end of file diff --git a/dpppt-config-backend/src/main/resources/logback.xml b/dpppt-config-backend/src/main/resources/logback.xml deleted file mode 100644 index 2fce6359..00000000 --- a/dpppt-config-backend/src/main/resources/logback.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - %d %p [%c] - <%m>%n - - - - - dp3t-config-ws.log - - %d %p [%c] - %m%n - - - 3 - dp3t-config-ws.log.%i - - - 512KB - - - - - - - - - - diff --git a/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/BaseControllerTest.java b/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/BaseControllerTest.java index bd91c1db..84ea64c9 100644 --- a/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/BaseControllerTest.java +++ b/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/BaseControllerTest.java @@ -18,6 +18,7 @@ import static org.junit.Assert.assertTrue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -48,6 +49,8 @@ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles({ "cloud-dev" }) +// to make sure prometheus is exposed in tests +@AutoConfigureMetrics public abstract class BaseControllerTest { @Autowired protected ObjectMapper objectMapper; diff --git a/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/TestApplication.java b/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/TestApplication.java index da684040..8003f047 100644 --- a/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/TestApplication.java +++ b/dpppt-config-backend/src/test/java/org/dpppt/switzerland/backend/sdk/config/ws/TestApplication.java @@ -14,7 +14,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; -@ComponentScan(basePackages = {"org.dpppt.switzerland.backend.sdk.config.ws.config"}) +@ComponentScan(basePackages = {"org.dpppt.switzerland.backend.sdk.config.ws.config", + "ch.admin.bag.covidcertificate.log", + "ch.admin.bag.covidcertificate.rest"}) @SpringBootApplication public class TestApplication { + }