Configuration Reference
Complete configuration options and environment setup
ReferenceBeginner• 8 min read
appsettings.json Structure
Core application configuration settings
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Information"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=modernapi_dev;Username=postgres;Password=postgres"
},
"JwtSettings": {
"Secret": "your-super-secure-jwt-secret-key-here-at-least-256-bits",
"Issuer": "ModernAPI",
"Audience": "ModernAPI.Client",
"ExpiryMinutes": 60,
"RefreshTokenExpiryDays": 30
},
"CorsSettings": {
"AllowedOrigins": [
"http://localhost:3000",
"http://localhost:3001"
],
"AllowCredentials": true
},
"RateLimitSettings": {
"EnableRateLimiting": true,
"PermitLimit": 100,
"Window": "00:01:00",
"QueueLimit": 10
}
}
Security Note: Never commit sensitive configuration like JWT secrets or connection strings to version control. Use environment variables or secure configuration providers for production.
Environment-Specific Configuration
Different settings for Development, Staging, and Production
Development
// appsettings.Development.json
{
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"DetailedErrors": true,
"ShowPII": true
}
Staging
// appsettings.Staging.json
{
"Logging": {
"LogLevel": {
"Default": "Information"
}
},
"DetailedErrors": false,
"ShowPII": false
}
Production
// appsettings.Production.json
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"DetailedErrors": false,
"ShowPII": false
}