This page catalogs the environment variables recognized by the Langflow backend. These variables control database connectivity, authentication behavior, server networking, CORS policy, file storage backends, and feature flags.
For details on how settings are loaded and validated at the Pydantic model level, see page 7.2. For frontend-side configuration constants, see page 7.3.
Langflow uses pydantic-settings to populate the Settings and AuthSettings models. Every field in these models is readable from an environment variable with the LANGFLOW_ prefix.
.env file passed to the CLI via the --env-file flag, or defaulting to .env in the working directorySettings class (lowest priority)The .env file is loaded at process startup via python-dotenv's load_dotenv(), called inside src/backend/base/langflow/__main__.py.
At runtime, the SettingsService wraps the Settings and AuthSettings models and is accessed across services via the get_settings_service() dependency defined in src/backend/base/langflow/services/deps.py.
Settings loading pipeline
Sources: src/backend/base/langflow/__main__.py1-40 src/backend/base/langflow/services/settings/base.py1-16 src/backend/base/langflow/main.py42-52
| Pattern | Example |
|---|---|
Field database_url in Settings | LANGFLOW_DATABASE_URL |
Field AUTO_LOGIN in AuthSettings | LANGFLOW_AUTO_LOGIN |
Field cors_origins in Settings | LANGFLOW_CORS_ORIGINS |
Field components_path in Settings | LANGFLOW_COMPONENTS_PATH |
The LANGFLOW_ prefix is enforced by the model_config in lfx.services.settings.base.Settings, which is re-exported to langflow.services.settings.base src/backend/base/langflow/services/settings/base.py1-16
These variables are consumed by AuthSettings, accessible via get_settings_service().auth_settings.
| Variable | Type | Default | Description |
|---|---|---|---|
LANGFLOW_AUTO_LOGIN | bool | true | Bypass the login screen and sign in automatically as the default superuser |
LANGFLOW_SUPERUSER | str | DEFAULT_SUPERUSER constant | Username for the auto-login superuser account |
LANGFLOW_SUPERUSER_PASSWORD | str | DEFAULT_SUPERUSER_PASSWORD constant | Password for the auto-login superuser account |
LANGFLOW_SECRET_KEY | str | auto-generated | Secret key used to sign JWTs; must be stable across restarts in multi-worker deployments |
LANGFLOW_JWT_EXPIRE_MINUTES | int | varies | Lifetime of access tokens in minutes |
The DEFAULT_SUPERUSER and DEFAULT_SUPERUSER_PASSWORD constants are defined in lfx.services.settings.constants and imported in src/backend/base/langflow/__main__.py src/backend/base/langflow/__main__.py22 and src/backend/base/langflow/services/utils.py src/backend/base/langflow/services/utils.py7
LANGFLOW_AUTO_LOGIN is explicitly set in the development backend Makefile target Makefile285-287 as LANGFLOW_AUTO_LOGIN=$(login).
The check at startup is:
src/backend/base/langflow/main.py184-187
These variables configure the DatabaseService defined in src/backend/base/langflow/services/database/service.py.
| Variable | Type | Default | Description |
|---|---|---|---|
LANGFLOW_DATABASE_URL | str | SQLite in user data dir | Full connection URL; SQLite and PostgreSQL are supported |
LANGFLOW_DATABASE_CONNECTION_RETRY | bool | false | Retry engine creation on failure |
LANGFLOW_DB_CONNECTION_SETTINGS | dict | {} | SQLAlchemy engine kwargs (pool size, timeouts, etc.) |
LANGFLOW_POOL_SIZE | int | — | Deprecated. Use LANGFLOW_DB_CONNECTION_SETTINGS instead |
LANGFLOW_ALEMBIC_LOG_FILE | str | relative path | Path to the Alembic migration log file |
LANGFLOW_ALEMBIC_LOG_TO_STDOUT | bool | false | Redirect Alembic output to stdout instead of a file |
The DatabaseService reads these fields at construction time src/backend/base/langflow/services/database/service.py45-89 A deprecation warning is emitted if pool_size is set directly src/backend/base/langflow/services/database/service.py130-143
Supported URL drivers:
sqlite → automatically upgraded to sqlite+aiosqlitepostgresql or postgres → upgraded to postgresql+psycopg (postgres prefix triggers a deprecation warning)src/backend/base/langflow/services/database/service.py111-128
These variables configure the uvicorn server and the CLI run command in src/backend/base/langflow/__main__.py.
| Variable | CLI flag | Description |
|---|---|---|
LANGFLOW_HOST | --host | Network interface to bind (e.g., 0.0.0.0 or 127.0.0.1) |
LANGFLOW_PORT | --port | Port to listen on (default 7860) |
LANGFLOW_WORKERS | --workers | Number of uvicorn worker processes |
LANGFLOW_LOG_LEVEL | --log-level | Logging level (debug, info, warning, error, critical) |
LANGFLOW_FRONTEND_PATH | --frontend-path | Filesystem path to the pre-built frontend static files |
LANGFLOW_OPEN_BROWSER | --open-browser / --no-open-browser | Whether to open the browser on startup |
The Makefile passes these as CLI flags rather than environment variables in most targets Makefile246-254 but every CLI option maps to a corresponding settings field that can also be set via its LANGFLOW_ prefixed environment variable.
CORS policy is applied via CORSMiddleware registered in src/backend/base/langflow/main.py.
| Variable | Type | Default | Description |
|---|---|---|---|
LANGFLOW_CORS_ORIGINS | str or list[str] | "*" | Allowed origins; use a JSON array string for multiple values |
LANGFLOW_CORS_ALLOW_CREDENTIALS | bool | true | Whether to include Access-Control-Allow-Credentials |
If both cors_origins == "*" and cors_allow_credentials == True (the defaults), the backend logs a warning at startup recommending that LANGFLOW_CORS_ORIGINS be restricted in production src/backend/base/langflow/main.py135-144
| Variable | Type | Description |
|---|---|---|
LANGFLOW_COMPONENTS_PATH | list[str] | Additional filesystem paths scanned for custom components at startup |
At startup, settings.components_path is extended with any bundle component paths loaded from remote URLs src/backend/base/langflow/main.py198-200 Custom components placed in directories listed here are discovered automatically. See page 9.1 for how to write custom components.
| Variable | Type | Default | Description |
|---|---|---|---|
LANGFLOW_STORAGE_TYPE | str | "local" | Storage backend: "local" or "s3" |
LANGFLOW_S3_BUCKET | str | — | S3 bucket name (required when LANGFLOW_STORAGE_TYPE=s3) |
LANGFLOW_S3_ACCESS_KEY_ID | str | — | AWS access key ID |
LANGFLOW_S3_SECRET_ACCESS_KEY | str | — | AWS secret access key |
LANGFLOW_S3_REGION_NAME | str | — | AWS region |
LANGFLOW_S3_ENDPOINT_URL | str | — | Custom endpoint (for S3-compatible services) |
LANGFLOW_MAX_FILE_SIZE_UPLOAD | int | — | Maximum upload size in bytes, enforced by ContentSizeLimitMiddleware |
The ContentSizeLimitMiddleware is imported and registered in src/backend/base/langflow/main.py src/backend/base/langflow/main.py40 For a full description of the file storage system, see page 9.4.
| Variable | Type | Description |
|---|---|---|
LANGFLOW_LANGFUSE_PUBLIC_KEY | str | Langfuse public key for tracing |
LANGFLOW_LANGFUSE_SECRET_KEY | str | Langfuse secret key |
LANGFLOW_LANGSMITH_API_KEY | str | LangSmith API key |
LANGFLOW_LANGWATCH_API_KEY | str | LangWatch API key |
OTEL_EXPORTER_OTLP_ENDPOINT | str | OpenTelemetry collector endpoint |
SENTRY_DSN | str | Sentry DSN for error tracking (read by sentry-sdk) |
The sentry-sdk[fastapi,loguru] integration is listed as a direct dependency of langflow-base src/backend/base/pyproject.toml60 The OpenTelemetry instrumentation is registered via FastAPIInstrumentor src/backend/base/langflow/main.py24
| Variable | Type | Default | Description |
|---|---|---|---|
LANGFLOW_AGENTIC_EXPERIENCE | bool | false | Enables the agentic-mode global variable initialization at startup |
LFX_DEV | bool | — | Enables development-mode behavior in the lfx package (used by build_component_index Makefile target) |
LANGFLOW_AGENTIC_EXPERIENCE is checked in the lifespan startup sequence src/backend/base/langflow/main.py231
LFX_DEV is used by the build_component_index Makefile target Makefile451-452 and is not part of the runtime Settings model.
Environment variables and their corresponding Settings fields
Sources: src/backend/base/langflow/main.py135-145 src/backend/base/langflow/main.py184-200 src/backend/base/langflow/services/database/service.py45-90 Makefile285-300
.env File UsageThe CLI run command accepts an --env-file option. When provided, the file is loaded before the pydantic-settings model is initialized, so values in the file are treated as environment variables.
The Makefile's run_cli target defaults to a local .env file Makefile246-254:
The scripts/setup/setup_env.sh script creates an empty .env if none exists scripts/setup/setup_env.sh1-11
LANGFLOW_WORKERS > 1), LANGFLOW_SECRET_KEY must be set explicitly and kept stable. Without it, each process generates its own key, making JWT tokens issued by one worker invalid on others.LANGFLOW_DATABASE_URL must point to a shared database (e.g., PostgreSQL) when running multiple workers; the default SQLite file is not safe for concurrent multi-process writes.LANGFLOW_CORS_ORIGINS to specific origin values (rather than "*") is required for production deployments where browsers enforce CORS policies with credentials.Sources: src/backend/base/langflow/main.py135-144 src/backend/base/langflow/services/database/service.py111-128
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.