From c0ae476beb01a4108e12565237281766e7d78afb Mon Sep 17 00:00:00 2001 From: hitanshu310 Date: Fri, 23 Jan 2026 21:14:48 +0530 Subject: [PATCH 1/4] Configure PostgreSQL database settings for test and production profiles - Add PostgreSQL datasource configuration for test and prod profiles - Use environment-specific database URL, username, and password variables - Set hibernate.ddl-auto=update for both profiles - Enable SQL logging in test, disable in production - Replace H2 in-memory database with PostgreSQL for consistency --- .../CFTunnels/Controllers/HomeController.java | 16 ---------------- src/main/resources/application-prod.properties | 13 ++++++++++++- src/main/resources/application-test.properties | 15 ++++++++++----- 3 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 src/main/java/com/hithomelabs/CFTunnels/Controllers/HomeController.java diff --git a/src/main/java/com/hithomelabs/CFTunnels/Controllers/HomeController.java b/src/main/java/com/hithomelabs/CFTunnels/Controllers/HomeController.java deleted file mode 100644 index 87bffcf..0000000 --- a/src/main/java/com/hithomelabs/CFTunnels/Controllers/HomeController.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hithomelabs.CFTunnels.Controllers; - - -import org.springframework.boot.web.servlet.error.ErrorController; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class HomeController implements ErrorController { - - private static final String ERROR_PATH = "/error"; - - - -} diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index dec0f4b..328b310 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -1 +1,12 @@ -api.baseUrl=https://cftunnels.hithomelabs.com \ No newline at end of file +api.baseUrl=https://cftunnels.hithomelabs.com + +# Production Database Configuration +spring.datasource.url=${PROD_DB_URL:jdbc:postgresql://postgres:5432/cftunnel} +spring.datasource.username=${PROD_DB_USERNAME:postgres} +spring.datasource.password=${PROD_DB_PASSWORD} +spring.datasource.driver-class-name=org.postgresql.Driver + +# JPA Configuration +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect \ No newline at end of file diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index a0ccff7..e4ef983 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,7 +1,12 @@ api.baseUrl=https://testcf.hithomelabs.com -spring.datasource.url: jdbc:h2:mem:testdb -spring.datasource.driver-class-name: org.h2.Driver -spring.datasource.username: sa -spring.datasource.password: -spring.datasource.jpa.hibernate.ddl-auto: none \ No newline at end of file +# Test Database Configuration - Same as Production +spring.datasource.url=${TEST_DB_URL:jdbc:postgresql://postgres:5432/cftunnel} +spring.datasource.username=${TEST_DB_USERNAME:postgres} +spring.datasource.password=${TEST_DB_PASSWORD} +spring.datasource.driver-class-name=org.postgresql.Driver + +# JPA Configuration +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -- 2.45.2 From b8b0a4bf30f4420119e0a9c9221347dbfe431416 Mon Sep 17 00:00:00 2001 From: hitanshu310 Date: Fri, 23 Jan 2026 21:22:16 +0530 Subject: [PATCH 2/4] Remove environment variable defaults and align with docker-compose - Remove default values from database environment variables - Use POSTGRES_USERNAME/PASSWORD to match docker-compose.yaml - Use DB_URL without default to ensure explicit configuration --- src/main/resources/application-prod.properties | 6 +++--- src/main/resources/application-test.properties | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 328b310..9b2c0b6 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -1,9 +1,9 @@ api.baseUrl=https://cftunnels.hithomelabs.com # Production Database Configuration -spring.datasource.url=${PROD_DB_URL:jdbc:postgresql://postgres:5432/cftunnel} -spring.datasource.username=${PROD_DB_USERNAME:postgres} -spring.datasource.password=${PROD_DB_PASSWORD} +spring.datasource.url=${DB_URL} +spring.datasource.username=${POSTGRES_USERNAME} +spring.datasource.password=${POSTGRES_PASSWORD} spring.datasource.driver-class-name=org.postgresql.Driver # JPA Configuration diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index e4ef983..bb6d864 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,9 +1,9 @@ api.baseUrl=https://testcf.hithomelabs.com # Test Database Configuration - Same as Production -spring.datasource.url=${TEST_DB_URL:jdbc:postgresql://postgres:5432/cftunnel} -spring.datasource.username=${TEST_DB_USERNAME:postgres} -spring.datasource.password=${TEST_DB_PASSWORD} +spring.datasource.url=${DB_URL} +spring.datasource.username=${POSTGRES_USERNAME} +spring.datasource.password=${POSTGRES_PASSWORD} spring.datasource.driver-class-name=org.postgresql.Driver # JPA Configuration -- 2.45.2 From e9675db11ad6a7f84ae1a65b6010196f92a79113 Mon Sep 17 00:00:00 2001 From: hitanshu310 Date: Fri, 23 Jan 2026 21:37:22 +0530 Subject: [PATCH 3/4] Remove fork sync job from test build workflow - Remove sync_forks job that was causing issues - Fork syncing doesn't work reliably in current setup - Keep core build and deployment functionality --- .gitea/workflows/test_image_build_push.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.gitea/workflows/test_image_build_push.yml b/.gitea/workflows/test_image_build_push.yml index a4ed4ea..2cf9344 100644 --- a/.gitea/workflows/test_image_build_push.yml +++ b/.gitea/workflows/test_image_build_push.yml @@ -64,23 +64,4 @@ jobs: run: | docker push 192.168.0.100:8928/hithomelabs/cftunnels:test docker push 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }} - sync_forks: - name: Sync All Forks - runs-on: ubuntu-latest - needs: build_tag_push - steps: - - name: Check out repository code - uses: actions/checkout@v4 - - name: Sync all forks via Gitea API - run: | - echo "Fetching forks for Hithomelabs/CFTunnels..." - response=$(curl -s -X GET "https://gitea.hithomelabs.com/api/v1/repos/Hithomelabs/CFTunnels/forks" -H "Authorization: token ${{secrets.TOKEN}}") - filtered=$(echo "$response" | grep -o '"clone_url":"[^"]*"' | sed 's/"clone_url":"\([^"]*\)"/\1/' | grep -v "/Hithomelabs") - echo "Detected forks:" - echo "$filtered" - readarray -t forks <<< "$filtered" - for fork_url in "${forks[@]}"; do - echo "🔄 Syncing fork: $fork_url" - authed_url=$(echo "$fork_url" | sed "s#https://#https://${{secrets.TOKEN}}@#") - git push "$authed_url" test & - done + -- 2.45.2 From c1ea9c4197d6161f54913c4e1e56ad51f6505bf6 Mon Sep 17 00:00:00 2001 From: hitanshu310 Date: Fri, 23 Jan 2026 23:23:39 +0530 Subject: [PATCH 4/4] Fix database URL configuration for docker-compose compatibility - Hardcode PostgreSQL connection URL to match docker service name 'postgres' - Remove DB_URL environment variable dependency that was causing startup failures - Keep username/password as environment variables for flexibility --- src/main/resources/application-prod.properties | 2 +- src/main/resources/application-test.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 9b2c0b6..cb15c36 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -1,7 +1,7 @@ api.baseUrl=https://cftunnels.hithomelabs.com # Production Database Configuration -spring.datasource.url=${DB_URL} +spring.datasource.url=jdbc:postgresql://postgres:5432/cftunnel spring.datasource.username=${POSTGRES_USERNAME} spring.datasource.password=${POSTGRES_PASSWORD} spring.datasource.driver-class-name=org.postgresql.Driver diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index bb6d864..b257503 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,7 +1,7 @@ api.baseUrl=https://testcf.hithomelabs.com # Test Database Configuration - Same as Production -spring.datasource.url=${DB_URL} +spring.datasource.url=jdbc:postgresql://postgres:5432/cftunnel spring.datasource.username=${POSTGRES_USERNAME} spring.datasource.password=${POSTGRES_PASSWORD} spring.datasource.driver-class-name=org.postgresql.Driver -- 2.45.2