Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #43 from admin-ch/feature/cfenv
Browse files Browse the repository at this point in the history
  • Loading branch information
gstoehld authored Dec 16, 2022
2 parents 06f01c3 + ab5732a commit 95d906a
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- name: Cache SonarCloud packages
uses: actions/cache@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tagged_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@v3
- run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11.0.7
java-version: 17
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file: :
distribution: 'zulu'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.0</version>
<version>42.5.0</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
<version>${spring-cloud-connectors-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public abstract class WsBaseConfig implements WebMvcConfigurer {
"#{${ws.security.headers: {'X-Content-Type-Options':'nosniff', 'X-Frame-Options':'DENY','X-Xss-Protection':'1; mode=block'}}}")
Map<String, String> additionalHeaders;

public abstract DataSource dataSource();

public abstract Flyway flyway();
public abstract Flyway flyway(DataSource dataSource);

public abstract IosHeartbeatSilentPush iosHeartbeatSilentPush(
DeliveryDataService pushRegistrationDataService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,12 @@
import javax.sql.DataSource;
import org.flywaydb.core.Flyway;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.CloudFactory;
import org.springframework.cloud.service.PooledServiceConnectorConfig.PoolConfig;
import org.springframework.cloud.service.relational.DataSourceConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public abstract class WsCloudBaseConfig extends WsBaseConfig {

@Value("${datasource.maximumPoolSize:5}")
int dataSourceMaximumPoolSize;

@Value("${datasource.connectionTimeout:30000}")
int dataSourceConnectionTimeout;

@Value("${datasource.leakDetectionThreshold:0}")
int dataSourceLeakDetectionThreshold;

@Value("${push.ios.signingkey}") // base64 encoded p8 file
private String iosPushSigningKey;

Expand All @@ -38,27 +26,13 @@ public abstract class WsCloudBaseConfig extends WsBaseConfig {
@Value("${push.ios.topic}")
private String iosPushTopic;

@Bean
@Override
public DataSource dataSource() {
PoolConfig poolConfig =
new PoolConfig(dataSourceMaximumPoolSize, dataSourceConnectionTimeout);
DataSourceConfig dbConfig =
new DataSourceConfig(
poolConfig,
null,
null,
Map.of("leakDetectionThreshold", dataSourceLeakDetectionThreshold));
CloudFactory factory = new CloudFactory();
return factory.getCloud().getSingletonServiceConnector(DataSource.class, dbConfig);
}

@Bean
@Override
public Flyway flyway() {
public Flyway flyway(DataSource dataSource) {
Flyway flyWay =
Flyway.configure()
.dataSource(dataSource())
.dataSource(dataSource)
.locations("classpath:/db/migration/pgsql_cluster")
.load();
flyWay.migrate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public DataSource dataSource() {

@Bean
@Override
public Flyway flyway() {
public Flyway flyway(DataSource dataSource) {
Flyway flyWay =
Flyway.configure()
.dataSource(dataSource())
.dataSource(dataSource)
.locations("classpath:/db/migration/pgsql")
.load();
flyWay.migrate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,9 @@
public class TestConfig extends WsBaseConfig {
private static final Logger logger = LoggerFactory.getLogger(TestConfig.class);

@Autowired DataSource dataSource;

@Override
public DataSource dataSource() {
return dataSource;
}

@Bean
@Override
public Flyway flyway() {
public Flyway flyway(DataSource dataSource) {
final var flyway =
Flyway.configure()
.dataSource(dataSource)
Expand Down
17 changes: 8 additions & 9 deletions ch-covidcertificate-backend-delivery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
<name>CH Covidcertificate Delivery Backend</name>

<properties>
<java-version>11</java-version>
<java-version>17</java-version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<spring-boot-version>2.7.2</spring-boot-version>
<spring-boot-version>2.7.5</spring-boot-version>
<jackson-version>2.11.1</jackson-version>
<jsonwebtoken-version>0.11.5</jsonwebtoken-version>
<testcontainers-version>1.17.3</testcontainers-version>
<shedlock.version>4.39.0</shedlock.version>
<spring-cloud-connectors-version>2.2.13.RELEASE</spring-cloud-connectors-version>
<spring-cloud-sleuth-version>3.1.3</spring-cloud-sleuth-version>
<testcontainers-version>1.17.6</testcontainers-version>
<shedlock.version>4.42.0</shedlock.version>
<spring-cloud-sleuth-version>3.1.5</spring-cloud-sleuth-version>

<itCoverageAgent/>

Expand Down Expand Up @@ -66,13 +65,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.0</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.0</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<!-- testcontainers -->
Expand Down Expand Up @@ -103,7 +102,7 @@
<dependency>
<groupId>ch.admin.bag.covidcertificate</groupId>
<artifactId>cc-backend-logging</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>

<!-- LogBack dependencies -->
Expand Down

0 comments on commit 95d906a

Please sign in to comment.