Overview
TaskForge API uses a class-based configuration system defined inapp/config.py. Three configuration classes inherit from a shared Config base:
| Class | FLASK_ENV value | Use case |
|---|---|---|
DevelopmentConfig | development | Local development with SQL echo enabled |
TestingConfig | testing | Pytest suite — uses in-memory SQLite, disables rate limiting |
ProductionConfig | production | Azure App Service deployment |
FLASK_ENV environment variable via get_config() in app/config.py:111.
Environment file setup
Copy.env.example to .env before running the application:
- Linux / macOS
- Windows
.env and update each value for your environment.
Variable reference
Application
Application
| Variable | Default | Description |
|---|---|---|
FLASK_APP | run.py | Entry point for the Flask CLI |
FLASK_ENV | development | Active configuration class (development, testing, production) |
SECRET_KEY | (insecure placeholder) | Flask session signing key — must be random in production |
JWT_SECRET_KEY | (insecure placeholder) | JWT signing key — must be random in production |
Database (Azure SQL)
Database (Azure SQL)
| Variable | Default | Description |
|---|---|---|
AZURE_SQL_SERVER | — | Fully qualified server hostname, e.g. server.database.windows.net |
AZURE_SQL_DATABASE | taskforge_db | Database name |
AZURE_SQL_USER | — | SQL login username |
AZURE_SQL_PASSWORD | — | SQL login password |
AZURE_SQL_PORT | 1433 | TCP port (standard SQL Server port) |
AZURE_SQL_SERVER, AZURE_SQL_USER, or AZURE_SQL_PASSWORD is absent, the application falls back to a local SQLite file (taskforge.db). See Database configuration below.JWT tokens
JWT tokens
| Variable | Default | Description |
|---|---|---|
JWT_ACCESS_TOKEN_EXPIRES | 3600 | Access token lifetime in seconds (1 hour) |
JWT_REFRESH_TOKEN_EXPIRES | 2592000 | Refresh token lifetime in seconds (30 days) |
Authorization: Bearer <token> header. The identity claim is stored under the sub key.Rate limiting
Rate limiting
| Variable | Default | Description |
|---|---|---|
RATELIMIT_ENABLED | true | Enable or disable rate limiting globally |
RATELIMIT_STORAGE_URL | memory:// | Storage backend for counters. Use a Redis URL in multi-worker deployments. |
RATELIMIT_DEFAULT | 200 per day;50 per hour | Default limits applied to all endpoints |
X-RateLimit-*) are always included in responses when limiting is enabled.CORS
CORS
| Variable | Default | Description |
|---|---|---|
CORS_ORIGINS | http://localhost:3000,http://localhost:5173 | Comma-separated list of allowed origins |
GET, POST, PUT, PATCH, DELETE, and OPTIONS. Allowed headers are Content-Type and Authorization.Pagination
Pagination
| Variable | Default | Description |
|---|---|---|
DEFAULT_PAGE_SIZE | 10 | Records returned per page when per_page is not specified |
MAX_PAGE_SIZE | 100 | Upper bound on per_page — requests above this are clamped |
Logging
Logging
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL | INFO | Python logging level (DEBUG, INFO, WARNING, ERROR) |
LOG_FORMAT | json | Log output format (json or text) |
Application metadata
Application metadata
| Variable | Default | Description |
|---|---|---|
APP_NAME | TaskForge API | Application name returned in health check responses |
APP_VERSION | 1.0.0 | Application version string |
Full .env.example
.env.example
Database configuration
The connection string is assembled inapp/config.py:31-38. When all four Azure SQL variables are present, the application connects using the mssql+pyodbc driver with ODBC Driver 17 for SQL Server:
The
TestingConfig class always overrides the database URI to sqlite:///:memory: regardless of environment variables, so tests never connect to a real database.AZURE_SQL_* variables from your .env and the SQLite fallback is used automatically. Initialize the schema with:
scripts/init_db_azure.sql against your database using Azure Data Studio or SQL Server Management Studio before starting the application.
Production security checklist
Before going to production, verify each of the following:| Setting | Required value |
|---|---|
SECRET_KEY | Cryptographically random string (at least 32 bytes) |
JWT_SECRET_KEY | Cryptographically random string (at least 32 bytes) |
FLASK_ENV | production |
DEBUG | Must be False — enforced by ProductionConfig |
AZURE_SQL_* | All four variables set — SQLite is not suitable for production |
SECRET_KEY and JWT_SECRET_KEY.