Skip to main content

Environment variables

OpenRAG's .env file is the primary configuration file for OpenRAG. Environment variables in .env always take precedence over other sources.

For deployments managed with the Terminal User Interface (TUI), this file is located at ~/.openrag/tui, and it can be created automatically during installation.

For self-managed deployments, this file can be located at the root of your OpenRAG project directory or referenced from another location.

For an example, see .env.example in the OpenRAG repository.

tip

OpenRAG's Docker Compose files are populated automatically using values from the .env file, so you don't need to edit the Docker Compose files manually.

If a variable isn't set, OpenRAG uses default or fallback values where available. Not all variables have default values, and errors can occur if required variables aren't set. Default values can be found in the reference tables on this page and in config_manager.py, settings.py, and logging_config.py.

You can temporarily set Langflow variables at runtime. However, these temporary overrides don't overlap with most OpenRAG environment variables. The only exceptions are flow-level Langflow settings, such as the language model used in a flow.

Edit the .env file

During installation, an initial .env file is created automatically or manually. You can edit this file to change OpenRAG configuration settings after installation.

Each OpenRAG environment variable is either mutable or immutable. This determines the actions you must take to apply changes after editing the .env file:

Model provider settings

Configure which models and providers OpenRAG uses to generate text and embeddings. You only need to provide credentials for the providers you are using in OpenRAG.

These variables are initially set during the application onboarding process. Some of these variables are immutable and can only be changed by redeploying OpenRAG, as explained in Set environment variables.

VariableDefaultDescription
EMBEDDING_MODELtext-embedding-3-smallEmbedding model for generating vector embeddings for documents in the knowledge base and similarity search queries. Can be changed after the application onboarding process. Accepts one or more models.
LLM_MODELgpt-4o-miniLanguage model for language processing and text generation in the Chat feature.
MODEL_PROVIDERopenaiModel provider, as one of openai, watsonx, ollama, or anthropic.
ANTHROPIC_API_KEYNot setAPI key for the Anthropic language model provider.
OPENAI_API_KEYNot setAPI key for the OpenAI model provider, which is also the default model provider.
OLLAMA_ENDPOINTNot setCustom provider endpoint for the Ollama model provider.
WATSONX_API_KEYNot setAPI key for the IBM watsonx.ai model provider.
WATSONX_ENDPOINTNot setCustom provider endpoint for the IBM watsonx.ai model provider.
WATSONX_PROJECT_IDNot setProject ID for the IBM watsonx.ai model provider.

Document processing settings

Control how OpenRAG processes and ingests documents into your knowledge base.

VariableDefaultDescription
CHUNK_OVERLAP200Overlap between chunks.
CHUNK_SIZE1000Text chunk size for document processing.
DISABLE_INGEST_WITH_LANGFLOWfalseDisable Langflow ingestion pipeline.
DOCLING_OCR_ENGINESet by OSOCR engine for document processing. For macOS, ocrmac. For any other OS, easyocr.
OCR_ENABLEDfalseEnable OCR for image processing.
OPENRAG_DOCUMENTS_PATH~/.openrag/documentsThe local documents path for ingestion.
PICTURE_DESCRIPTIONS_ENABLEDfalseEnable picture descriptions.

Langflow settings

Configure the OpenRAG Langflow server's authentication, contact point, and built-in flow definitions.

info

The LANGFLOW_SUPERUSER_PASSWORD is set in your .env file, and this value determines the default values for several other Langflow authentication variables.

If the LANGFLOW_SUPERUSER_PASSWORD variable isn't set, then the Langflow server starts without authentication enabled.

For better security, it is recommended to set LANGFLOW_SUPERUSER_PASSWORD so the Langflow server starts with authentication enabled.

VariableDefaultDescription
LANGFLOW_AUTO_LOGINDetermined by LANGFLOW_SUPERUSER_PASSWORDWhether to enable auto-login mode for the Langflow visual editor and CLI. If LANGFLOW_SUPERUSER_PASSWORD isn't set, then LANGFLOW_AUTO_LOGIN is True and auto-login mode is enabled. If LANGFLOW_SUPERUSER_PASSWORD is set, then LANGFLOW_AUTO_LOGIN is False and auto-login mode is disabled. Langflow API calls always require authentication with a Langflow API key regardless of the auto-login setting.
LANGFLOW_ENABLE_SUPERUSER_CLIDetermined by LANGFLOW_SUPERUSER_PASSWORDWhether to enable the Langflow CLI langflow superuser command. If LANGFLOW_SUPERUSER_PASSWORD isn't set, then LANGFLOW_ENABLE_SUPERUSER_CLI is True and superuser accounts can be created with the Langflow CLI. If LANGFLOW_SUPERUSER_PASSWORD is set, then LANGFLOW_ENABLE_SUPERUSER_CLI is False and the langflow superuser command is disabled.
LANGFLOW_NEW_USER_IS_ACTIVEDetermined by LANGFLOW_SUPERUSER_PASSWORDWhether new Langflow user accounts are active by default. If LANGFLOW_SUPERUSER_PASSWORD isn't set, then LANGFLOW_NEW_USER_IS_ACTIVE is True and new user accounts are active by default. If LANGFLOW_SUPERUSER_PASSWORD is set, then LANGFLOW_NEW_USER_IS_ACTIVE is False and new user accounts are inactive by default.
LANGFLOW_PUBLIC_URLhttp://localhost:7860Public URL for the Langflow instance. Forms the base URL for Langflow API calls and other interfaces with your OpenRAG Langflow instance.
LANGFLOW_KEYAutomatically generatedA Langflow API key to run flows with Langflow API calls. Because Langflow API keys are server-specific, allow OpenRAG to generate this key initially. You can create additional Langflow API keys after deploying OpenRAG.
LANGFLOW_SECRET_KEYAutomatically generatedSecret encryption key for Langflow internal operations. It is recommended to generate your own Langflow secret key for this variable. If this variable isn't set, then Langflow generates a secret key automatically.
LANGFLOW_SUPERUSERadminUsername for the Langflow administrator user.
LANGFLOW_SUPERUSER_PASSWORDNot setLangflow administrator password. If this variable isn't set, then the Langflow server starts without authentication enabled. It is recommended to set LANGFLOW_SUPERUSER_PASSWORD so the Langflow server starts with authentication enabled.
LANGFLOW_URLhttp://localhost:7860URL for the Langflow instance.
LANGFLOW_CHAT_FLOW_ID, LANGFLOW_INGEST_FLOW_ID, NUDGES_FLOW_IDBuilt-in flow IDsThese variables are set automatically to the IDs of the chat, ingestion, and nudges flows. The default values are found in .env.example. Only change these values if you want to replace a built-in flow with your own custom flow. The flow JSON must be present in your version of the OpenRAG codebase. For example, if you deploy self-managed services, you can add the flow JSON to your local clone of the OpenRAG repository before deploying OpenRAG.
SYSTEM_PROMPTYou are a helpful AI assistant with access to a knowledge base. Answer questions based on the provided context.System prompt instructions for the agent driving the Chat flow.

OAuth provider settings

Configure OAuth providers and external service integrations.

VariableDefaultDescription
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Not setEnable access to AWS S3 with an AWS OAuth app integration.
GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET
Not setEnable the Google OAuth client integration. You can generate these values in the Google Cloud Console.
MICROSOFT_GRAPH_OAUTH_CLIENT_ID
MICROSOFT_GRAPH_OAUTH_CLIENT_SECRET
Not setEnable the Microsoft Graph OAuth client integration by providing Azure application registration credentials for SharePoint and OneDrive.
WEBHOOK_BASE_URLNot setBase URL for OAuth connector webhook endpoints. If this variable isn't set, a default base URL is used.

OpenSearch settings

Configure OpenSearch database authentication.

VariableDefaultDescription
OPENSEARCH_HOSTlocalhostOpenSearch instance host.
OPENSEARCH_PORT9200OpenSearch instance port.
OPENSEARCH_USERNAMEadminOpenSearch administrator username.
OPENSEARCH_PASSWORDMust be set at start upRequired. OpenSearch administrator password. Must adhere to the OpenSearch password complexity requirements. You must set this directly in the .env or in the TUI's Basic/Advanced Setup.

System settings

Configure general system components, session management, and logging.

VariableDefaultDescription
LANGFLOW_KEY_RETRIES15Number of retries for Langflow key generation.
LANGFLOW_KEY_RETRY_DELAY2.0Delay between retries in seconds.
LANGFLOW_VERSIONOPENRAG_VERSIONLangflow Docker image version. By default, OpenRAG uses the OPENRAG_VERSION for the Langflow Docker image version.
LOG_FORMATNot setSet to json to enabled JSON-formatted log output. If this variable isn't set, then the default logging format is used.
LOG_LEVELINFOLogging level. Can be one of DEBUG, INFO, WARNING, or ERROR. DEBUG provides the most detailed logs but can impact performance.
MAX_WORKERS1Maximum number of workers for document processing.
OPENRAG_VERSIONlatestThe version of the OpenRAG Docker images to run. For more information, see Upgrade OpenRAG
SERVICE_NAMEopenragService name for logging.
SESSION_SECRETAutomatically generatedSession management.