CFTunnels/database-config-changes.md

49 lines
1.6 KiB
Markdown

# Database Configuration Changes
## Production Profile Changes (application-prod.properties)
```properties
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=validate
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
```
## Test Profile Changes (application-test.properties)
```properties
api.baseUrl=https://testcf.hithomelabs.com
# Test Database Configuration - Using H2 in-memory
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=create-drop
spring.jpa.show-sql=true
spring.sql.init.mode=always
```
## Required Production Environment Variables
Set these in your production deployment:
- `PROD_DB_URL` - PostgreSQL connection URL
- `PROD_DB_USERNAME` - PostgreSQL username
- `PROD_DB_PASSWORD` - PostgreSQL password
## Key Differences
- **Production**: Uses PostgreSQL with `validate` DDL mode (no schema changes)
- **Test**: Uses H2 in-memory with `create-drop` DDL mode (fresh DB each test)
## How to Scroll This File
- **Terminal**: Use `less filename.md` and arrow keys, or `more filename.md`
- **Editor**: Use mouse wheel or arrow keys
- **Command line**: Use `cat filename.md | head -20` for first 20 lines