Overview
The Soft-Bee API supports multiple environment configurations to facilitate development, testing, and production deployments. The environment is controlled via theFLASK_ENV variable.
The application automatically loads environment-specific configuration files (
.env.{environment}) if they exist, allowing you to override settings per environment.Available Environments
The API supports four distinct environments:Local
Used for local development on your machine.Set to
local for local development environment- DEBUG:
True - TESTING:
False - Default Database:
postgresql://postgres:postgres@localhost:5432/softbee_local - Frontend URL:
http://localhost:3000 - Base URL:
http://localhost:5000
Development
Used for development servers and team collaboration.Set to
development for development server environment- DEBUG:
True - TESTING:
False - Default Database:
postgresql://postgres:postgres@localhost:5432/softbee_dev
Production
Used for production deployments.Set to
production for production environment- DEBUG:
False - TESTING:
False - Database: Must be provided via
DATABASE_URLenvironment variable - Validation: Enforces presence of critical security variables
Testing
Used for automated testing and CI/CD pipelines.Set to
testing for test environment- DEBUG:
True - TESTING:
True - Default Database:
postgresql://postgres:postgres@localhost:5432/softbee_test - CSRF Protection: Disabled for easier testing
Environment Variables
General Configuration
Flask secret key for session management and cryptographic operations
URL Configuration
URL of the frontend application (used for CORS and redirects)
Base URL of the API server
Environment-Specific Files
You can create environment-specific.env files that override the main .env file:
Configuration Loading Priority
The application loads configuration in the following order:- Loads
.envfile (if exists) - Reads
FLASK_ENVvariable to determine environment - Loads
.env.{environment}file (if exists) - overrides step 1 - Applies environment-specific configuration class
- Environment variables override all file-based settings
Environment-specific files (
.env.{environment}) override values from the main .env file, allowing you to maintain a base configuration with environment-specific overrides.Example Setup
Local Development
Production Deployment
Next Steps
Database Configuration
Learn how to configure PostgreSQL connections
JWT Configuration
Configure authentication and token settings