Appearance
Environment Variables
Root .env (Docker Compose)
Used by docker-compose.yml and docker-compose.override.yml.
| Variable | Default | Required | Description |
|---|---|---|---|
DB_ROOT_PASSWORD | — | ✅ | MySQL root password |
DB_PASSWORD | — | ✅ | Password for the medregia application user |
DB_CONNECTION_STRING | — | ✅ (prod) | Full connection string for the API in production |
API_PORT | 5000 | — | Host port for the API container |
FRONTEND_PORT | 80 | — | Host port for the frontend container |
ASPNETCORE_ENVIRONMENT | Production | — | ASP.NET environment name |
Backend: appsettings.json / appsettings.Development.json
| Key | Default | Description |
|---|---|---|
ConnectionStrings:DefaultConnection | See file | MySQL connection string |
Jwt:SecretKey | CHANGE_ME_... | 🔴 Must be changed — HS256 signing secret (min 32 chars) |
Jwt:Issuer | MedRegia | JWT issuer claim |
Jwt:Audience | MedRegiaUsers | JWT audience claim |
Jwt:ExpirationHours | 24 | Token lifetime in hours |
Connection String Format
Server=<host>;Port=3306;Database=medregia_ca_db;Uid=<user>;Pwd=<password>;SslMode=None;AllowPublicKeyRetrieval=True;Override for Development (appsettings.Development.json)
Values here override appsettings.json in the Development environment:
json
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;Database=medregia_ca_db;Uid=medregia;Pwd=dev_password;SslMode=None;AllowPublicKeyRetrieval=True;"
},
"Jwt": {
"SecretKey": "dev_only_secret_key_32_chars_minimum"
}
}Frontend: Vite .env Files
| Variable | Default (dev) | Description |
|---|---|---|
VITE_API_BASE_URL | http://localhost:5000/api | Backend API base URL |
Files
| File | When loaded |
|---|---|
.env | Always |
.env.development | npm run dev |
.env.production | npm run build |
Production Build
When building for production via Docker, the VITE_API_BASE_URL is set to /api (same-origin Nginx proxy):
dockerfile
# In frontend/Dockerfile
ARG VITE_API_BASE_URL=/apiThis means the frontend makes API calls to /api/* which Nginx proxies to the API container.
Security Notes
Never Commit Secrets
- Never commit real
Jwt:SecretKeyvalues to source control - Never commit
.envfiles with real passwords - Use a
.gitignoreentry for.envandappsettings.Development.json - In production, inject secrets via container environment variables or a secrets manager