Overview
The Product Distribution Dashboard uses environment variables to configure database connections, external data sources, frontend integration, and scheduling. The application supports multiple Spring profiles (dev and prod) with profile-specific configurations.
Spring Profiles
The active profile is controlled by theSPRING_PROFILES_ACTIVE environment variable:
dev if not specified.
Environment Variables Reference
Core Application
| Variable | Required | Default | Description |
|---|---|---|---|
SPRING_PROFILES_ACTIVE | No | dev | Active Spring profile (dev/prod) |
PORT | No | 8080 | Server port for the backend application |
Database Configuration (Dev Profile)
| Variable | Required | Default | Description |
|---|---|---|---|
SPRING_DATASOURCE_URL | Yes | - | JDBC URL for PostgreSQL database |
SPRING_DATASOURCE_USERNAME | Yes | - | Database username |
SPRING_DATASOURCE_PASSWORD | Yes | - | Database password |
Database Configuration (Prod Profile)
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_HOST | Yes | - | PostgreSQL server hostname |
DATABASE_PORT | Yes | - | PostgreSQL server port |
DATABASE_NAME | Yes | - | Database name |
DATABASE_USERNAME | Yes | - | Database username |
DATABASE_PASSWORD | Yes | - | Database password |
Frontend Integration
| Variable | Required | Default | Description |
|---|---|---|---|
APP_FRONTEND_URL | Yes | - | Frontend application URL for CORS configuration |
External Data Sources
| Variable | Required | Default | Description |
|---|---|---|---|
DATA_PRODUCTS_URL | No | GitHub raw URL | URL for products JSON data |
DATA_STORES_URL | No | GitHub raw URL | URL for stores JSON data |
DATA_WAREHOUSES_URL | No | GitHub raw URL | URL for warehouses JSON data |
Scheduler Configuration
| Variable | Required | Default (Dev) | Default (Prod) | Description |
|---|---|---|---|---|
SCHEDULER_DISTRIBUTION_CRON | No | 3 * * * * * | 0 0 2 * * * | Cron expression for distribution scheduler |
0 0 2 * * *- Every day at 2:00 AM0 0 */6 * * *- Every 6 hours0 30 8 * * MON-FRI- Weekdays at 8:30 AM
Docker Compose Configuration
When running with Docker Compose, the following environment variables are configured:Profile-Specific Behavior
Development Profile
- Simple database URL configuration via
SPRING_DATASOURCE_URL - Frequent scheduler execution (every minute) for testing
- No SSL requirement for database connections
Production Profile
- Parameterized database connection (host, port, database name)
- SSL required for database connections (
sslmode=require) - Batch insert optimization enabled (
reWriteBatchedInserts=true) - HikariCP connection pooling configured
- Hibernate batch processing enabled
- Daily scheduler execution at 2:00 AM
- Server binds to all interfaces (
0.0.0.0)
Warehouse Selection Strategy
The warehouse selection strategy is configured inapplication.properties (not an environment variable):
distanceOnlyStrategy- Orders warehouses by distance onlydistanceWithToleranceStrategy- Considers distance tolerance and product stock