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 #50 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 26ddf75 + 40ecfb5 commit 9f8ba66
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 43 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 @@ -40,10 +40,10 @@
<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>
<groupId>io.pivotal.cfenv</groupId>
<artifactId>java-cfenv-boot</artifactId>
<version>2.4.1</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 @@ -68,9 +68,7 @@ public abstract class WsBaseConfig {
@Value("${ws.rate-limit:10}")
private int rateLimit;

public abstract DataSource dataSource();

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

public abstract BitClient bitClient(
ClientRegistrationRepository clientRegistration, ObjectMapper objectMapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
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;
import org.springframework.context.annotation.Profile;
Expand Down Expand Up @@ -49,25 +46,10 @@ public class WsCloudConfig extends WsBaseConfig {

@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 @@ -74,10 +74,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 @@
@Configuration
public class TestConfig extends WsBaseConfig {

@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
3 changes: 1 addition & 2 deletions ch-covidcertificate-backend-transformation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
<name>CH Covidcertificate Transformation 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.3</spring-boot-version>
<spring-cloud-sleuth-version>3.1.3</spring-cloud-sleuth-version>
<spring-cloud-connectors-version>2.2.13.RELEASE</spring-cloud-connectors-version>
<testcontainers-version>1.17.3</testcontainers-version>
<shedlock-version>4.41.0</shedlock-version>

Expand Down

0 comments on commit 9f8ba66

Please sign in to comment.