Compare commits

..

5 Commits

Author SHA1 Message Date
057d0120b7 db port variable added
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m37s
sample gradle build and test / tag (push) Successful in 7s
sample gradle build and test / build_tag_push (push) Successful in 2m6s
Promote image with tag test to prod / tag (push) Successful in 6s
Promote image with tag test to prod / build_tag_push (push) Successful in 18s
2025-10-12 23:58:14 +05:30
b804cc978f dialect readded
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m35s
sample gradle build and test / tag (push) Successful in 7s
sample gradle build and test / build_tag_push (push) Successful in 3m21s
2025-10-12 23:38:40 +05:30
729d0ddcfc sql init set to never
Some checks failed
sample gradle build and test / build (pull_request) Failing after 1m31s
2025-10-12 23:28:24 +05:30
bbadd41ec4 bug fixes
Some checks failed
sample gradle build and test / build (pull_request) Failing after 1m37s
2025-10-12 22:55:05 +05:30
c567cf766d Postgres integration
Some checks failed
sample gradle build and test / build (pull_request) Failing after 4m41s
2025-10-12 21:59:55 +05:30
5 changed files with 78 additions and 3 deletions

View File

@ -27,6 +27,9 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.hibernate.validator:hibernate-validator'
}
tasks.named('test') {

View File

@ -12,6 +12,20 @@ services:
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID}
- OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET}
- HOST_PORT=${HOST_PORT}
- POSTGRES_USER=${POSTGRES_USERNAME}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
env_file:
- stack.env
restart: unless-stopped
postgres:
image: postgres:15-alpine
container_name: cftunnel-db
environment:
POSTGRES_DB: cftunnel
POSTGRES_USER: ${POSTGRES_USERNAME}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
restart: unless-stopped
ports:
- "${DB_PORT}:5432"
volumes:
- ${DB_PATH}:/var/lib/postgresql/data

View File

@ -1 +1,10 @@
api.corsResolveUrl=http://localhost:8080
management.health.db.enabled=true
management.endpoints.web.exposure.include=health
management.endpoint.health.show-details=always
logging.level.org.hibernate.SQL=DEBUG
debug=true
spring.datasource.url=jdbc:postgresql://localhost:5432/cftunnel

View File

@ -17,3 +17,15 @@ spring.security.oauth2.client.provider.cftunnels.token-uri=https://auth.hithomel
spring.security.oauth2.client.provider.cftunnels.user-info-uri=https://auth.hithomelabs.com/application/o/userinfo/
spring.security.oauth2.client.provider.cftunnels.jwk-set-uri=https://auth.hithomelabs.com/application/o/cftunnels/jwks/
spring.security.oauth2.client.provider.cftunnels.issuer-uri=https://auth.hithomelabs.com/application/o/cftunnels/
spring.datasource.url=jdbc:postgresql://192.168.0.100:5432/cftunnel
spring.datasource.username=${POSTGRES_USERNAME}
spring.datasource.password=${POSTGRES_PASSWORD}
spring.datasource.driver-class-name=org.postgresql.Driver
spring.sql.init.mode=never
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.open-in-view=false

View File

@ -0,0 +1,37 @@
-- schema.sql
-- Roles table
CREATE TABLE IF NOT EXISTS roles (
role_id SERIAL PRIMARY KEY,
role_name VARCHAR(50) UNIQUE NOT NULL
);
-- Users table
CREATE TABLE IF NOT EXISTS users (
user_id SERIAL PRIMARY KEY,
user_name VARCHAR(100) NOT NULL,
password VARCHAR(255) NOT NULL
);
-- User-Role Mapping table (many-to-many relationship)
CREATE TABLE IF NOT EXISTS user_role_mapping (
mapping_id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
role_id INTEGER NOT NULL REFERENCES roles(role_id) ON DELETE CASCADE
);
-- Tunnels table
CREATE TABLE IF NOT EXISTS tunnels (
tunnel_id SERIAL PRIMARY KEY,
tunnel_name VARCHAR(100) NOT NULL,
tunnel_type VARCHAR(50) NOT NULL
);
-- Mapping Requests table
CREATE TABLE IF NOT EXISTS mapping_requests (
request_id SERIAL PRIMARY KEY,
request_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(20) NOT NULL,
user_id INTEGER REFERENCES users(user_id) ON DELETE SET NULL,
tunnel_id INTEGER REFERENCES tunnels(tunnel_id) ON DELETE SET NULL
);