Environment Variables
All credentials and configuration options are managed through environment variables. Never hardcode credentials in source code.
Required variables
Section titled “Required variables”| Variable | Description | Example |
|---|---|---|
MSSQL_SERVER | SQL Server hostname or IP | prod-server.database.windows.net |
MSSQL_DATABASE | Database name | ProductionDB |
MSSQL_USER | SQL Server username | app_user |
MSSQL_PASSWORD | SQL Server password | (secret) |
Optional variables
Section titled “Optional variables”| Variable | Default | Description |
|---|---|---|
MSSQL_PORT | 1433 | SQL Server port |
DEVELOPER_MODE | false | true for development (relaxed TLS, detailed errors) |
MSSQL_READ_ONLY | false | Blocks write operations |
MSSQL_WHITELIST_TABLES | (empty) | Tables allowed for modification in read-only mode |
MSSQL_AUTH | sql | Authentication mode: sql, integrated, azure |
MSSQL_ENCRYPT | (auto) | TLS encryption control. Only effective with DEVELOPER_MODE=true. false = disable encryption (required for SQL Server 2008/2012). If not set: false in dev, always true in production |
MSSQL_CONNECTION_STRING | (empty) | Custom connection string (overrides other variables) |
.env template
Section titled “.env template”# Copy and editcp .env.example .env
# Example contentMSSQL_SERVER=localhostMSSQL_DATABASE=MyDBMSSQL_USER=saMSSQL_PASSWORD=YourPassword123MSSQL_PORT=1433DEVELOPER_MODE=trueMSSQL_READ_ONLY=falseLoading variables
Section titled “Loading variables”Linux/macOS:
source .envWindows PowerShell:
Get-Content .env | ForEach-Object { $name, $value = $_ -split '=', 2 [Environment]::SetEnvironmentVariable($name, $value)}File permissions
Section titled “File permissions”# Linux/macOSchmod 600 .env
# Windowsicacls .env /inheritance:r /grant:r "%USERNAME%:R"