-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs/sonarqube-documentation
- Loading branch information
Showing
16 changed files
with
214 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Cache Maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Set up Maven settings.xml | ||
run: | | ||
mkdir -p ~/.m2 | ||
echo "<settings> | ||
<servers> | ||
<server> | ||
<id>github-webank</id> | ||
<username>${{ github.actor }}</username> | ||
<password>${{ secrets.WEBANK_ACCESS_TOKEN }}</password> | ||
</server> | ||
</servers> | ||
</settings>" > ~/.m2/settings.xml | ||
- name: Build JAR | ||
run: mvn clean package -DskipTests | ||
|
||
- name: Verify JAR File Exists | ||
run: | | ||
if [ ! -f ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar ]; then | ||
echo "JAR file not found!" && exit 1 | ||
fi | ||
- name: Log in to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_PAT }} | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} . | ||
- name: Push Docker image to GHCR | ||
run: | | ||
docker push ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ log | |
|
||
cms-db-schema/liquibase.properties | ||
ledgers-db/liquibase.properties | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: '3.8' | ||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "9200:8080" | ||
environment: | ||
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} | ||
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} | ||
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} | ||
depends_on: | ||
- db | ||
|
||
db: | ||
image: postgres:15 | ||
container_name: postgres_container | ||
ports: | ||
- "5433:5432" | ||
environment: | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
obs/obs-rest/src/main/java/com/adorsys/webank/obs/resource/Host.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.adorsys.webank.obs.resource; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
|
||
import java.util.Enumeration; | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
public class Host { | ||
|
||
@GetMapping("/host") | ||
public String getApplicationUrl(HttpServletRequest request) { | ||
// Construct the URL | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("scheme: ").append(request.getScheme()).append("\n"); // http or https | ||
sb.append("serverName: ").append(request.getServerName()).append("\n"); // server name | ||
sb.append("serverPort: ").append(request.getServerPort()).append("\n"); // server port | ||
sb.append("contextPath: ").append(request.getContextPath()).append("\n"); // application context path (if any) | ||
|
||
Enumeration<String> headerNames = request.getHeaderNames(); | ||
while (headerNames.hasMoreElements()) { | ||
String headerName = headerNames.nextElement(); | ||
sb.append(headerName).append(": "); | ||
|
||
Enumeration<String> headers = request.getHeaders(headerName); | ||
while (headers.hasMoreElements()) { | ||
sb.append(headers.nextElement()).append(" "); | ||
} | ||
sb.append("\n"); | ||
} | ||
|
||
// Format the URL | ||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
online-banking-app/src/main/java/com/adorsys/webank/config/ForwardedHeaderConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//package com.adorsys.webank.config; | ||
// | ||
//import org.springframework.context.annotation.Bean; | ||
//import org.springframework.context.annotation.Configuration; | ||
//import org.springframework.web.filter.ForwardedHeaderFilter; | ||
// | ||
//@Configuration | ||
//public class ForwardedHeaderConfig { | ||
// | ||
// @Bean | ||
// public ForwardedHeaderFilter forwardedHeaderFilter() { | ||
// return new ForwardedHeaderFilter(); | ||
// } | ||
//} |
14 changes: 14 additions & 0 deletions
14
online-banking-app/src/main/java/com/adorsys/webank/config/RedirectConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.adorsys.webank.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
public class RedirectConfig implements WebMvcConfigurer { | ||
|
||
@Override | ||
public void addViewControllers(ViewControllerRegistry registry) { | ||
registry.addViewController("/").setViewName("redirect:/swagger-ui.html"); | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
online-banking-app/src/main/java/com/adorsys/webank/config/WebConfig.java
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
online-banking-app/src/main/resources/application-h2.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
spring.datasource.url=jdbc:h2:mem:testdb | ||
spring.datasource.driver-class-name=org.h2.Driver | ||
spring.datasource.username=sa | ||
spring.datasource.password= | ||
spring.jpa.hibernate.ddl-auto=create-drop | ||
spring.jpa.show-sql=true | ||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect |
6 changes: 6 additions & 0 deletions
6
online-banking-app/src/main/resources/application-postgres.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/online_banking_db} | ||
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres} | ||
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres} | ||
spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.show-sql=true | ||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect |
14 changes: 1 addition & 13 deletions
14
online-banking-app/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
# H2 Database Configuration | ||
spring.h2.console.enabled=true | ||
spring.datasource.url=jdbc:h2:mem:testdb | ||
server.forward-headers-strategy=framework | ||
|
||
# Swagger Configuration | ||
springdoc.api-docs.path=/api-docs | ||
springdoc.swagger-ui.path=/swagger-ui.html | ||
|
||
# Additional Settings (if needed) | ||
spring.datasource.driver-class-name=org.h2.Driver | ||
spring.datasource.username=sa | ||
spring.datasource.password= | ||
|
||
# Hibernate DDL auto (update, create-drop, validate, etc.) | ||
spring.jpa.hibernate.ddl-auto=update | ||
spring.cloud.compatibility-verifier.enabled=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters