RAG Service
← Back to Documentation Center

Setup & Environment Variables

This page documents the required and optional environment variables for configuring the RAG API Core service, including loading order, Azure integration, and security best practices.


Loading Order

  1. Blob storage config (if CONFIG_SOURCE=blob_storage and reachable)
  2. Filesystem YAML (CONFIG_PATH fallback)
  3. Environment variable overrides (highest precedence per-field)

Core Source Selection

Variable Values Default Purpose
CONFIG_SOURCE filesystem / blob_storage filesystem Select where to load base YAML config
CONFIG_PATH path/to/file.yml resources/configs/development_config.yml Filesystem config path
CONFIG_STORAGE_ACCOUNT acct name Blob storage account for config (blob mode)
CONFIG_CONTAINER container name configs Blob container containing config
CONFIG_DIRECTORY subfolder (empty) Optional directory prefix
CONFIG_FILENAME filename.yml development_config.yml Config file name

API Overrides

Variable Example Notes
RAG_API_HOST 0.0.0.0 Bind host
RAG_API_PORT 8000 Bind port
RAG_API_TITLE My RAG Service Overrides API metadata title

Azure OpenAI

Variable Example
AZURE_OPENAI_ENDPOINT https://myopenai.openai.azure.com/
AZURE_OPENAI_API_KEY sk-...
AZURE_OPENAI_DEPLOYMENT gpt-4o
AZURE_OPENAI_MODEL gpt-4o

Variable Example
AZURE_SEARCH_ENDPOINT https://mysearch.search.windows.net
AZURE_SEARCH_API_KEY xxxx
AZURE_SEARCH_INDEX_NAME documents

Azure Storage (Prompts & Uploads)

Variable Example Description
AZURE_STORAGE_ACCOUNT mystorageacct Base storage account for blobs
PROMPTS_CONTAINER prompts Container for prompt templates
PROMPTS_STORAGE_SOURCE filesystem / blob_storage Where to load prompts

Security / Secrets

Variable Example Notes
KEY_VAULT_NAME MyKeyVault Use Managed Identity where possible

Usage Examples

Development (filesystem):

$env:CONFIG_PATH = "resources/configs/development_config.yml"

Blob-based dev:

$env:CONFIG_SOURCE = "blob_storage"
$env:CONFIG_STORAGE_ACCOUNT = "myacct"
$env:CONFIG_CONTAINER = "configs"
$env:CONFIG_DIRECTORY = "dev"
$env:CONFIG_FILENAME = "development_config.yml"

Troubleshooting

  • Missing blob variables: falls back to filesystem
  • Blob auth failures: ensure Managed Identity or AZURE_* credentials configured
  • YAML parse errors: validate syntax and file path

Security Notes

Store secrets in Key Vault or managed identities; avoid committing secrets. Environment variables should only override non-secret or already vaulted values.