Environments - Dify Docs (original) (raw)

Common Variables

CONSOLE_API_URL

The backend URL for the console API. This is used to construct the authorization callback. If left empty, it defaults to the same domain as the application. Example: https://api.console.dify.ai

CONSOLE_WEB_URL

The front-end URL of the console web interface. This is used to construct front-end addresses and for CORS configuration. If left empty, it defaults to the same domain as the application. Example: https://console.dify.ai

SERVICE_API_URL

The Service API URL, used to display Service API Base URL in the front-end. If left empty, it defaults to the same domain as the application. Example: https://api.dify.ai

APP_API_URL

The WebApp API backend URL, used to specify the backend URL for the front-end API. If left empty, it defaults to the same domain as the application. Example: https://app.dify.ai

APP_WEB_URL

The WebApp URL, used to display File preview or download Url to the front-end or as Multi-model inputs; If left empty, it defaults to the same domain as the application. Example: https://udify.app/

FILES_URL

The prefix for file preview or download URLs, used to display these URLs in the front-end and provide them as input for multi-modal models. To prevent forgery, image preview URLs are signed and expire after 5 minutes.


Server

MODE

Startup mode: This is only available when launched using docker. It is not applicable when running from source code.

DEBUG

Debug mode: Disabled by default. It’s recommended to enable this setting during local development to prevent issues caused by monkey patching.

FLASK_DEBUG

Flask debug mode: When enabled, it outputs trace information in the API responses, facilitating easier debugging.

SECRET_KEY

A secret key used for securely signing session cookies and encrypting sensitive information in the database.

This variable must be set before the first launch.

Run openssl rand -base64 42 to generate a strong key for it.

DEPLOY_ENV

Deployment environment:

LOG_LEVEL

The log output level. Default is INFO. For production environments, it’s recommended to set this to ERROR.

MIGRATION_ENABLED

When set to true, database migrations are automatically executed on container startup. This is only available when launched using docker and does not apply when running from source code.

For source code launches, you need to manually run flask db upgrade in the api directory.

CHECK_UPDATE_URL

Controls the version checking policy. If set to false, the system will not call https://updates.dify.ai to check for updates.

Currently, the version check interface based on CloudFlare Worker is not directly accessible in China. Setting this variable to an empty value will disable this API call.

TEXT_GENERATION_TIMEOUT_MS

Default value: 60000 (milliseconds). Specifies the timeout for text generation and workflow processes. This setting prevents system-wide service disruptions caused by individual processes exceeding their allocated time.

OPENAI_API_BASE

Used to change the OpenAI base address, default is https://api.openai.com/v1.

When OpenAI cannot be accessed in China, replace it with a domestic mirror address, or when a local model provides OpenAI compatible API, it can be replaced.

Only effective when starting with docker image or docker-compose.

Database Configuration

The database uses PostgreSQL. Please use the public schema.

Redis Configuration

This Redis configuration is used for caching and for pub/sub during conversation.

Celery Configuration

CORS Configuration

Used to set the front-end cross-domain access policy.

File Storage Configuration

Used to store uploaded data set files, team/tenant encryption keys, and other files.

Vector Database Configuration

Knowledge Configuration

Multi-modal Configuration

Sentry Configuration

Used for application monitoring and error log tracking.

Notion Integration Configuration

Notion integration configuration variables can be obtained by applying for Notion integration: https://www.notion.so/my-integrations

ModelProvider & Tool Position Configuration

Used to specify the model providers and tools that can be used in the app. These settings allow you to customize which tools and model providers are available, as well as their order and inclusion/exclusion in the app’s interface.

For a list of available tools and model providers, please refer to the provided links.

Others


Web Frontend

SENTRY_DSN

Sentry DSN address, default is empty, when empty, all monitoring information is not reported to Sentry.

Deprecated

CONSOLE_URL

⚠️ Modified in 0.3.8, will be deprecated in 0.4.9, replaced by: CONSOLE_API_URL and CONSOLE_WEB_URL.

Console URL, used to concatenate the authorization callback, console front-end address, and CORS configuration use. If empty, it is the same domain. Example: https://console.dify.ai.

API_URL

⚠️ Modified in 0.3.8, will be deprecated in 0.4.9, replaced by SERVICE_API_URL.

API URL, used to display Service API Base URL to the front-end. If empty, it is the same domain. Example: https://api.dify.ai

APP_URL

⚠️ Modified in 0.3.8, will be deprecated in 0.4.9, replaced by APP_API_URL and APP_WEB_URL.

WebApp Url, used to display WebAPP API Base Url to the front-end. If empty, it is the same domain. Example: https://udify.app/

Session Configuration

⚠️ This configuration is no longer valid since v0.3.24.

Only used by the API service for interface identity verification.

⚠️ This configuration is no longer valid since v0.3.24.

Used to set the browser policy for session cookies used for identity verification.

Chunk Length Configuration

INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH

Configuration for document chunk length. It is used to control the size of text segments when processing long documents. Default: 500. Maximum: 4000.

Larger Chunks

Smaller Chunks

Configuration Recommendations