Overview
This page documents all environment variables used across the SGIVU microservices architecture. Variables follow the format${VAR_NAME:default_value} where :default_value is optional.
Variables without default values are required and will cause startup failure if not set.
Variable Format
Spring Boot configuration files use the following syntax:Common Variables (All Services)
These variables are used across multiple services in base configuration files.Service Discovery
Eureka service registry URL. All microservices register with Eureka for service discovery.Example values:
- Dev:
http://localhost:8761/eureka - Prod:
http://eureka-server.sgivu.internal:8761/eureka
Service URLs
Authorization server URL for OAuth2 authentication.Used by: Gateway, User, Client, Vehicle, Purchase-Sale services
API Gateway URL.Used by: Auth service
User service URL for internal service-to-service calls.Used by: Auth, Purchase-Sale services
Client service URL.Used by: Purchase-Sale service
Vehicle service URL.Used by: Purchase-Sale service
Security
Shared secret for internal service-to-service authentication. No default value.Used by: Auth, User, Client, Vehicle, Purchase-Sale servicesSecurity requirements:
- Minimum 64 characters
- Cryptographically random
- Different per environment
- Rotated periodically
OAuth2 client secret for gateway-auth communication. No default value.Used by: Auth service (server), Gateway service (client)Security requirements:
- Minimum 32 characters
- Keep in sync between auth and gateway
- Store in secrets management system
Server Configuration
HTTP server port for the service.Default ports:
- Gateway:
8080 - User:
8081 - Client:
8082 - Vehicle:
8083 - Purchase-Sale:
8084 - Auth:
9000 - Discovery:
8761
OAuth2 issuer URL for JWT token validation.Used by: Auth service
Flyway Migrations
Whether Flyway should baseline an existing database.Usage:
- Dev:
true(allows migrations on existing schemas) - Prod:
false(requires explicit baseline)
Auth Service Variables
Database (Dev)
PostgreSQL host for auth service in dev environment.
PostgreSQL port for auth service in dev environment.
Database name for auth service in dev. No default value.
Database username for auth service in dev. No default value.
Database password for auth service in dev. No default value.
Database (Prod)
PostgreSQL host for auth service in production.
PostgreSQL port for auth service in production.
Database name for auth service in production. No default value.
Database username for auth service in production. No default value.
Database password for auth service in production. No default value.
JWT Configuration
File path or classpath location of the JWT signing keystore. No default value.Example values:
file:/etc/sgivu/jwt-keystore.jksclasspath:keystore/jwt.jks
Password for the JWT keystore file. No default value.
Alias of the signing key within the keystore. No default value.
Password for the signing key. No default value.
Application URLs
Angular frontend URL in dev environment. No default value.Example:
http://localhost:4200Used for: OAuth redirects, CORS configurationAngular frontend URL in production. No default value.Example:
https://app.sgivu.comBase URL for OpenAPI “Try it out” feature in production. No default value.Example:
https://api.sgivu.comUsed by: Auth, User, Client, Vehicle, Purchase-Sale services (prod only)Gateway Service Variables
Redis Session Store
Redis server hostname for session management.Production: Use managed Redis service (ElastiCache, Redis Cloud, etc.)
Redis server port.
Redis authentication password. No default value.Security: Always set a strong password for Redis in all environments.
User Service Variables
Database (Dev)
PostgreSQL host for user service in dev.
PostgreSQL port for user service in dev.
Database name for user service in dev. No default value.
Database username for user service in dev. No default value.
Database password for user service in dev. No default value.
Database (Prod)
PostgreSQL host for user service in production. No default value.
PostgreSQL port for user service in production. No default value.
Database name for user service in production. No default value.
Database username for user service in production. No default value.
Database password for user service in production. No default value.
Client Service Variables
Database (Dev)
PostgreSQL host for client service in dev.
PostgreSQL port for client service in dev.
Database name for client service in dev. No default value.
Database username for client service in dev. No default value.
Database password for client service in dev. No default value.
Database (Prod)
PostgreSQL host for client service in production. No default value.
PostgreSQL port for client service in production. No default value.
Database name for client service in production. No default value.
Database username for client service in production. No default value.
Database password for client service in production. No default value.
Vehicle Service Variables
Database (Dev)
PostgreSQL host for vehicle service in dev.
PostgreSQL port for vehicle service in dev.
Database name for vehicle service in dev. No default value.
Database username for vehicle service in dev. No default value.
Database password for vehicle service in dev. No default value.
Database (Prod)
PostgreSQL host for vehicle service in production. No default value.
PostgreSQL port for vehicle service in production. No default value.
Database name for vehicle service in production. No default value.
Database username for vehicle service in production. No default value.
Database password for vehicle service in production. No default value.
AWS S3 Configuration
S3 bucket name for vehicle images. No default value.Example:
sgivu-vehicle-images-prodPermissions required:s3:PutObjects3:GetObjects3:DeleteObjects3:ListBucket
Comma-separated list of allowed CORS origins for S3 bucket.Production example:
https://app.sgivu.com,https://www.sgivu.comAWS IAM access key ID. No default value.Best practice: Use IAM roles instead of access keys when running on AWS infrastructure.
AWS IAM secret access key. No default value.Security: Never commit this value to version control.
AWS region for S3 bucket. No default value.Example:
us-east-1, eu-west-1Purchase Sale Service Variables
Database (Dev)
PostgreSQL host for purchase-sale service in dev.
PostgreSQL port for purchase-sale service in dev.
Database name for purchase-sale service in dev. No default value.
Database username for purchase-sale service in dev. No default value.
Database password for purchase-sale service in dev. No default value.
Database (Prod)
PostgreSQL host for purchase-sale service in production. No default value.
PostgreSQL port for purchase-sale service in production. No default value.
Database name for purchase-sale service in production. No default value.
Database username for purchase-sale service in production. No default value.
Database password for purchase-sale service in production. No default value.
Setting Environment Variables
Local Development
Create a.env file (not committed to git):
Docker Compose
Kubernetes Secrets
Kubernetes ConfigMap (Non-Sensitive)
Security Best Practices
Never Commit Secrets
Never commit passwords, API keys, or secrets to the config repository or any version control.
Use Strong Secrets
Generate cryptographically random secrets with sufficient length (64+ characters for shared secrets).
Rotate Regularly
Implement a rotation schedule for all secrets (quarterly or semi-annually).
Principle of Least Privilege
Grant services only the permissions they need (database users, IAM roles, etc.).
Use Secrets Management
Use dedicated secrets management (Vault, AWS Secrets Manager, etc.) in production.
Audit Access
Monitor and log access to secrets and sensitive configuration.
Required vs Optional Variables
Required (No Defaults)
These variables must be set or the service will fail to start:Security Secrets
Security Secrets
SERVICE_INTERNAL_SECRET_KEYSGIVU_GATEWAY_SECRETJWT_KEYSTORE_LOCATIONJWT_KEYSTORE_PASSWORDJWT_KEY_ALIASJWT_KEY_PASSWORDREDIS_PASSWORD
Database Credentials
Database Credentials
All
*_DB_NAME, *_DB_USERNAME, *_DB_PASSWORD variables (no defaults)AWS Configuration
AWS Configuration
AWS_VEHICLES_BUCKETAWS_ACCESS_KEYAWS_SECRET_KEYAWS_REGION
Application URLs
Application URLs
DEV_ANGULAR_APP_URL(dev profile)PROD_ANGULAR_APP_URL(prod profile)OPENAPI_SERVER_URL(prod profile)
Optional (With Defaults)
These variables have sensible defaults for Docker/Kubernetes networking:EUREKA_URL(default:http://sgivu-discovery:8761/eureka)SGIVU_AUTH_URL(default:http://sgivu-auth:9000)SGIVU_GATEWAY_URL(default:http://sgivu-gateway:8080)- Service URLs (all have Docker service name defaults)
PORT(each service has a default port)REDIS_HOST(default:sgivu-redis)REDIS_PORT(default:6379)- Database hosts/ports in dev (default:
host.docker.internal:5432)
Validation Checklist
Before deploying, verify all required variables are set:See Also
Overview
Profile mechanism and configuration merging
Dev Environment
Development environment setup
Prod Environment
Production deployment and security