Skip to Content
DocumentationEnvironment

Revornix Environment Variables

Last verified against the codebase: 2026-04-06

This document is organized around the actual read points in the repository and describes how Revornix environment variables are structured and loaded.

Recommended deployment boundaries:

  • Application services are started manually: gateway, api, celery-worker, web, hot-news
  • Only the “local infrastructure dependencies” Docker path remains: docker-compose-local.yaml + .env.local
  • The full application is not started through one all-in-one Compose file

1. Configuration Entrypoints

ScenarioExample fileActual fileHow it is loadedNotes
API serviceapi/.env.exampleapi/.envMultiple load_dotenv(override=True) callsValues in .env override external environment variables with the same name
Celery Workercelery-worker/.env.examplecelery-worker/.envMultiple load_dotenv(override=True) callsSame behavior as API
Web frontendweb/.env.exampleweb/.envnext.config.ts + Next runtimeChanges usually require a rebuild
Gateway servicegateway/.env.examplegateway/.envBuilt-in lightweight .env parsing + go run ./cmd/gatewayUnified public entrypoint, path-based routing, and split-region auth proxy
Hot News serviceNo committed sample filehot-news/.env if you create onedotenv.config()This repo does not commit hot-news/.env.example
Local infrastructure Docker.env.local.example.env.localdocker compose -f docker-compose-local.yaml --env-file .env.local up -dOnly used for infrastructure dependencies such as Postgres / Redis / Neo4j / MinIO / Milvus

Additional notes:

  • The root-level .env.example is not part of this configuration path.
  • .env.local.example behaves like an aggregated local bootstrap sample. The actual application services still use the .env files inside their own directories.
  • hot-news is the exception: if you need per-service overrides, create hot-news/.env because there is no committed sample file in the repo.

2. Parsing and Runtime Rules

2.1 API / Worker

  • Many api and celery-worker entrypoints call load_dotenv(override=True).
  • That means if .env and the external shell environment define the same variable, the value from .env wins.
  • The following boolean checks now accept case-insensitive truthy values: 1, true, yes, on, y
  • The main switches affected by this rule include:
    • API_SENTRY_ENABLE
    • WORKER_SENTRY_ENABLE
    • ALI_DASHSCOPE_EMBEDDING_ON
    • OFFICIAL
    • NEXT_PUBLIC_ALLOW_THIRD_PARTY_AUTH (frontend helper)
  • BILIBILI_QR_LOGIN_ON_STARTUP and YOUTUBE_COOKIE_ON_STARTUP also accept case-insensitive boolean text.

2.2 Web

  • web/next.config.ts injects frontend-required environment variables into the build output.
  • NEXT_PUBLIC_* variables follow the standard public-env convention.
  • Because of that, changes to frontend-related variables usually require running pnpm build again.

2.3 Hot News

  • hot-news uses dotenv.config() and does not force .env values to override external variables the way API / Worker do.
  • Boolean parsing here is stricter: only the string true (case-insensitive) is treated as true. 1 and yes do not work.

2.4 Gateway

  • gateway uses a lightweight built-in .env loader and does not rely on an extra config package.
  • If the shell environment and gateway/.env both define the same variable, the shell value is preserved.
  • This is useful when you want to separate public hosts, path prefixes, and upstream pools by environment.

3. Hard Startup Dependencies

“Hard dependency” here means that based on the current import chain and startup path, missing values will either cause an immediate startup error or make the service unusable right after startup.

3.1 Required for API startup right now

  • OAUTH_SECRET_KEY
  • LANGFUSE_PUBLIC_KEY
  • LANGFUSE_SECRET_KEY
  • POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB_URL / POSTGRES_DB
  • REDIS_URL / REDIS_PORT
  • MILVUS_CLUSTER_ENDPOINT / MILVUS_TOKEN
  • NEO4J_USER / NEO4J_PASS / NEO4J_URI
  • FILE_SYSTEM_SERVER_PUBLIC_URL / FILE_SYSTEM_USER_NAME / FILE_SYSTEM_PASSWORD
  • APIKEY_ENCRYPT_KEY
  • ENGINE_CONFIG_ENCRYPT_KEY
  • FILE_SYSTEM_CONFIG_ENCRYPT_KEY
  • NOTIFICATION_SOURCE_CONFIG_ENCRYPT_KEY
  • NOTIFICATION_TARGET_CONFIG_ENCRYPT_KEY
  • SMTP_HOST / SMTP_PORT / SMTP_USERNAME / SMTP_PASSWORD
  • TENCENT_SECRET_ID / TENCENT_SECRET_KEY / TENCENT_SMS_SDK_APP_ID / TENCENT_SMS_APP_KEY / TENCENT_SMS_SIGN

The reason is not that every feature is always called immediately. The current API route import chain already pulls in the related modules, for example:

  • api/common/dependencies.py
  • api/common/encrypt.py
  • api/router/user.py
  • api/router/user_auth_phone.py
  • api/router/graph.py

3.2 Required for Worker startup right now

  • OAUTH_SECRET_KEY
  • LANGFUSE_PUBLIC_KEY
  • LANGFUSE_SECRET_KEY
  • POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB_URL / POSTGRES_DB
  • REDIS_URL / REDIS_PORT
  • MILVUS_CLUSTER_ENDPOINT / MILVUS_TOKEN
  • NEO4J_USER / NEO4J_PASS / NEO4J_URI
  • FILE_SYSTEM_SERVER_PUBLIC_URL / FILE_SYSTEM_USER_NAME / FILE_SYSTEM_PASSWORD
  • APIKEY_ENCRYPT_KEY
  • ENGINE_CONFIG_ENCRYPT_KEY
  • FILE_SYSTEM_CONFIG_ENCRYPT_KEY
  • NOTIFICATION_SOURCE_CONFIG_ENCRYPT_KEY
  • NOTIFICATION_TARGET_CONFIG_ENCRYPT_KEY

The current Worker startup chain goes through:

  • celery-worker/common/celery/app.py
  • celery-worker/common/dependencies.py
  • celery-worker/common/encrypt.py
  • celery-worker/proxy/notification_proxy.py
  • Multiple workflow / proxy / data modules

Additional notes:

  • The Worker repo still contains utility modules for SMTP_* and TENCENT_*, but the normal startup path does not currently import them.
  • ROOT_USER_NAME / ROOT_USER_PASSWORD are not required for Worker startup right now. They are mainly used by API initialization scripts.

3.3 Hard requirements only in initialization scripts

VariableWhen it is requiredMain read pointNotes
ROOT_USER_NAME / ROOT_USER_PASSWORDWhen running python -m data.sql.createapi/data/sql/create.pyCreates the root user
OFFICIAL_MODEL_PROVIDER_API_KEY / OFFICIAL_MODEL_PROVIDER_BASE_URLWhen OFFICIAL is enabled and the official seed path is executedapi/data/sql/create.pyInitializes the official model provider

4. Variable Details

4.1 Shared infrastructure and security variables

VariableServicesRequired levelDefault / exampleMain read pointsPurpose
OAUTH_SECRET_KEYapi, workerRequired at startupNoneapi/config/oauth2.py, api/common/jwt_utils.py, celery-worker/config/oauth2.pyJWT signing key; API and Worker must use the same value
POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB_URL / POSTGRES_DBapi, workerRequired at startupExample: revornix / 12345678 / localhost / revornixapi/data/sql/base.py, celery-worker/data/sql/base.py, api/alembic/env.pyPostgreSQL connection
REDIS_URL / REDIS_PORTapi, workerRequired at startupExample: localhost / 6379api/common/redis.py, api/common/celery/app.py, celery-worker/common/celery/app.pyAPI cache and Celery broker/backend
MILVUS_CLUSTER_ENDPOINT / MILVUS_TOKENapi, workerRequired at startupExample: http://localhost:19530 / root:Milvusapi/data/milvus/base.py, celery-worker/data/milvus/base.pyVector database
NEO4J_USER / NEO4J_PASS / NEO4J_URIapi, workerRequired at startupExample: neo4j / 12345678 / bolt://localhost:7687api/data/neo4j/base.py, celery-worker/data/neo4j/base.pyGraph database
FILE_SYSTEM_SERVER_PUBLIC_URL / FILE_SYSTEM_USER_NAME / FILE_SYSTEM_PASSWORDapi, workerRequired at startupExample: local MinIOapi/file/built_in_remote_file_service.py, celery-worker/file/built_in_remote_file_service.pyBuilt-in file system (MinIO / S3-compatible)
APIKEY_ENCRYPT_KEYapi, workerRequired at startupNoneapi/common/encrypt.py, celery-worker/common/encrypt.pyMaster key for API key encryption
ENGINE_CONFIG_ENCRYPT_KEYapi, workerRequired at startupNoneSame as aboveMaster key for engine configuration encryption
FILE_SYSTEM_CONFIG_ENCRYPT_KEYapi, workerRequired at startupNoneSame as aboveMaster key for file system configuration encryption
NOTIFICATION_SOURCE_CONFIG_ENCRYPT_KEYapi, workerRequired at startupNoneSame as aboveMaster key for notification source configuration encryption
NOTIFICATION_TARGET_CONFIG_ENCRYPT_KEYapi, workerRequired at startupNoneSame as aboveMaster key for notification target configuration encryption
LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEYapi, workerRequired at startupNoneapi/common/dependencies.py, celery-worker/common/dependencies.pyThe current code validates them strictly during import
LANGFUSE_BASE_URLapi, workerOptionalNoneapi/config/langfuse.py, celery-worker/config/langfuse.pyCurrently only read into config; there is no direct call site in this repo yet
OFFICIALapi, workerOptionalExample: Falseapi/common/dependencies.py, celery-worker/common/dependencies.pyOfficial deployment switch; uses case-insensitive boolean parsing
DEPLOY_HOSTSapi (worker currently keeps config only)OptionalConfig default is localhost; the sample shows official domainsapi/config/base.py, api/common/dependencies.py, celery-worker/config/base.pyOfficial-host detection on the API side; Worker does not currently consume it further
WEB_BASE_URLapi, workerRecommendedNoneapi/notification/tool/*.py, celery-worker/notification/tool/*.py, api/common/oauth_redirect.pyExpands relative links into full notification links and acts as the unified public callback base for Google / GitHub OAuth

4.2 Authentication, third-party login, and notifications

VariableServicesRequired levelDefault / exampleMain read pointsPurpose
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRETapiRequired when Google login is enabledNoneapi/router/user_auth_google.pyBackend config for Google OAuth
GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRETapiRequired when GitHub login is enabledNoneapi/router/user_auth_github.pyBackend config for GitHub OAuth
WECHAT_WEB_APP_ID / WECHAT_WEB_APP_SECRETapiRequired for WeChat web loginNoneapi/router/user_auth_wechat.pyWeChat web login / binding
WECHAT_MINI_APP_ID / WECHAT_MINI_APP_SECRETapiRequired for WeChat Mini Program loginNoneapi/router/user_auth_wechat.pyMini Program login
WECHAT_OFFICIAL_APP_ID / WECHAT_OFFICIAL_APP_SECRET / WECHAT_OFFICIAL_TOKEN / WECHAT_OFFICIAL_ENCODING_AES_KEYapiRequired for WeChat Official Account message integrationNoneapi/router/wechat_official.pySecure mode and message handling for WeChat Official Account
WECHAT_HTTP_TIMEOUT_SECONDSapiOptional20api/common/tp_auth/wechat_utils.pyTimeout in seconds for WeChat HTTP requests
SMTP_HOST / SMTP_PORT / SMTP_USERNAME / SMTP_PASSWORDapiCurrently required for API startupNoneapi/common/system_email/email.py, api/router/user.py, api/router/notification_target_manage.pyEmail verification codes and notification email
TENCENT_SECRET_ID / TENCENT_SECRET_KEY / TENCENT_SMS_SDK_APP_ID / TENCENT_SMS_APP_KEY / TENCENT_SMS_SIGNapiCurrently required for API startupNoneapi/common/sms/tencent_sms.py, api/router/user_auth_phone.pyPhone verification codes
IOS_DEEPLINK_SCHEMEapi, workerOptionalrevornixapi/notification/tool/apple.py, celery-worker/notification/tool/apple.pyDeep link scheme for iOS push notifications

4.3 Bilibili / YouTube credentials and startup authentication

VariableServicesRequired levelDefault / exampleMain read pointsPurpose
REVORNIX_CREDENTIAL_DIRapi, workerOptional~/.local/state/revornixapi/engine/video_plugins/bilibili_auth.py, api/engine/video_plugins/youtube_auth.pyRoot directory for stored credentials
BILIBILI_CREDENTIAL_ENCRYPT_KEYapi, workerRequired when using Bilibili credential cacheNone*_bilibili_auth.pyEncrypts Bilibili credential files
BILIBILI_CREDENTIAL_FILEapi, workerOptional${REVORNIX_CREDENTIAL_DIR}/bilibili_auth/credential.jsonSame as aboveCustom credential file path
BILIBILI_QR_LOGIN_ON_STARTUPapi, workerOptionalFalseSame as aboveAttempt QR login on startup
BILIBILI_QR_LOGIN_TIMEOUT_SECONDSapi, workerOptional300Same as aboveTotal QR login timeout
BILIBILI_QR_LOGIN_POLL_TIMEOUT_SECONDSapi, workerOptional8Same as aboveSingle polling timeout
YOUTUBE_CREDENTIAL_ENCRYPT_KEYapi, workerRecommended to set separately when using YouTube cookie cacheNone*_youtube_auth.pyEncrypts YouTube cookies; falls back to BILIBILI_CREDENTIAL_ENCRYPT_KEY if unset
YOUTUBE_CREDENTIAL_FILEapi, workerOptional${REVORNIX_CREDENTIAL_DIR}/youtube_auth/cookie.jsonSame as aboveCustom cookie cache path
YOUTUBE_YTDLP_COOKIE_FILEapi, workerOptionalNoneSame as abovePath to an external cookie file for first import
YOUTUBE_COOKIE_ON_STARTUPapi, workerOptionalFalseSame as aboveImport or load YouTube cookies on startup

4.4 Observability, vector settings, and Worker-only switches

VariableServicesRequired levelDefault / exampleMain read pointsPurpose
API_SENTRY_ENABLE / API_SENTRY_DSNapiOptionalDisabled by defaultapi/main.pyAPI Sentry initialization
WORKER_SENTRY_ENABLE / WORKER_SENTRY_DSNworkerOptionalDisabled by defaultcelery-worker/common/celery/app.pyWorker Sentry initialization with CeleryIntegration
WORKFLOW_TIMING_VERBOSEworkerOptional0celery-worker/workflow/timing.pyEmit detailed workflow timing logs
ALI_DASHSCOPE_EMBEDDING_ONapi, workerOptionalFalseapi/engine/embedding/factory.py, celery-worker/engine/embedding/factory.pySwitch to Alibaba DashScope embedding
ALI_DASHSCOPE_EMBEDDING_API_KEYapi, workerRequired when the previous switch is trueNoneapi/engine/embedding/qwen_cloud.py, same file name in workerDashScope embedding API key
WS_OFFLINE_CACHE_TTL_SECONDSapiOptional86400api/common/websocket.pyTTL for cached offline WebSocket messages
WS_OFFLINE_CACHE_MAX_MESSAGESapiOptional200api/common/websocket.pyMax number of retained offline WebSocket messages

4.5 Official deployment and seed-only variables

VariableServicesRequired levelDefault / exampleMain read pointsPurpose
ROOT_USER_NAME / ROOT_USER_PASSWORDapiRequired by initialization scriptsNoneapi/data/sql/create.pyCreates the root user and default resources
OFFICIAL_MODEL_PROVIDER_API_KEY / OFFICIAL_MODEL_PROVIDER_BASE_URLapiRequired when OFFICIAL=true and seeding official modelsNoneapi/data/sql/create.pyInitializes the official model provider

Additional note:

  • These four variables also appear in celery-worker/.env.example, but the current normal Worker startup path does not use them.

4.6 Web frontend variables

VariableRequired levelDefault / exampleMain read pointsPurpose
NEXT_PUBLIC_API_PREFIXRecommendedhttp://localhost:8001web/next.config.ts, web/src/config/api.tsAPI base URL
NEXT_PUBLIC_NOTIFICATION_WS_API_PREFIXRecommendedws://localhost:8001/notification/wsSame as aboveNotification WebSocket URL
NEXT_PUBLIC_HOT_NEWS_API_PREFIXRecommendedhttp://localhost:6688Same as aboveHot News service URL
NEXT_PUBLIC_WECHAT_APP_IDRequired when third-party login UI is enabledEmptyweb/next.config.ts, login / binding componentsApp ID used by the frontend WeChat login button
NEXT_PUBLIC_ALLOW_THIRD_PARTY_AUTHOptionalfalseweb/src/lib/env.ts, email-login-form.tsx, phone-login-form.tsx, account/page.tsxControls whether third-party login / binding UI is shown
NEXT_PUBLIC_HOSTRecommendedhttp://localhost:3000web/next.config.ts, section-publish.tsx, web/src/lib/oauth.tsShare links, frontend self-references, and the unified public callback entrypoint for third-party login
NEXT_PUBLIC_DEPLOY_HOSTSOptionalSample official domain listweb/src/lib/utils.ts, account/page.tsxDetermines whether official subscription features are shown
NEXT_PUBLIC_GA_IDOptionalEmptyweb/src/app/layout.tsxGoogle Analytics

4.7 Gateway variables

VariableRequired levelDefault / exampleMain read pointsPurpose
PORTRecommended8787gateway/src/config.js, gateway/src/index.jsGateway listen port
GATEWAY_PUBLIC_API_HOSTSSet based on deploymentEmptySame as aboveMatches public API hosts
GATEWAY_PUBLIC_HOT_NEWS_HOSTSSet based on deploymentEmptySame as aboveMatches public hot-news hosts
GATEWAY_API_PATH_PREFIXESSet for single-domain prefix deploymentsEmptySame as aboveMatches API path prefixes on a shared domain
GATEWAY_HOT_NEWS_PATH_PREFIXESSet for single-domain prefix deploymentsEmptySame as aboveMatches hot-news path prefixes on a shared domain
GATEWAY_STRIP_API_PATH_PREFIXOptionalfalsegateway/src/config.js, gateway/src/router.jsWhether the API prefix is stripped before proxying
GATEWAY_STRIP_HOT_NEWS_PATH_PREFIXOptionalfalseSame as aboveWhether the hot-news prefix is stripped before proxying
GATEWAY_API_UPSTREAMSRecommendedhttp://localhost:8001Same as aboveUpstream pool for the domestic main api; supports multiple addresses
GATEWAY_AUTH_API_UPSTREAMSRequired when split-region Google / GitHub login is enabledhttp://localhost:8001Same as aboveUpstream pool for the overseas auth api
GATEWAY_HOT_NEWS_UPSTREAMSRecommendedhttp://localhost:6688Same as aboveUpstream pool for hot-news
GATEWAY_UPSTREAM_RETRY_COOLDOWN_MSOptional30000gateway/src/config.js, gateway/src/services.jsCooldown period after an upstream failure
GATEWAY_ENABLE_ACCESS_LOGOptionaltruegateway/src/config.js, gateway/src/index.jsWhether access logs are emitted

5. Hot News Service Variables

hot-news currently parses all of these in hot-news/src/config.ts.

VariableDefaultMain purpose
NODE_ENVStartup scripts usually set it to developmentIn src/index.ts, the service only auto-starts in development or docker
PORT6688Service port
DISALLOW_ROBOTtrueWhether robots.txt blocks crawling
CACHE_TTL3600TTL for NodeCache / Redis cache
REQUEST_TIMEOUT6000Timeout for fetching external data
ALLOWED_DOMAIN*CORS fallback domain
ALLOWED_HOSTimsyy.topAllowed suffix for CORS host whitelist
USE_LOG_FILEtrueWhether to write log files
RSS_MODEfalseWhether to force RSS mode
REDIS_HOSTlocalhostRedis host used by Hot News itself
REDIS_PORT6379Redis port used by Hot News itself
REDIS_PASSWORDEmptyRedis password used by Hot News itself

Notes:

  • hot-news uses REDIS_HOST / REDIS_PORT, which is a different naming scheme from the main project’s REDIS_URL / REDIS_PORT used by API / Worker.
  • Hot News boolean parsing accepts only true, not 1 or yes.

6. .env.local and docker-compose-local.yaml

This path is only responsible for local infrastructure dependencies. It does not start the full application stack.

6.1 Variables actually consumed by docker-compose-local.yaml

VariablePurpose
POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DBPostgres container initialization
FILE_SYSTEM_USER_NAME / FILE_SYSTEM_PASSWORDAccount credentials for the MinIO file service
NEO4J_USER / NEO4J_PASSDefault Neo4j authentication
ETCD_AUTO_COMPACTION_MODE / ETCD_AUTO_COMPACTION_RETENTION / ETCD_QUOTA_BACKEND_BYTES / ETCD_SNAPSHOT_COUNTEtcd settings required by Milvus
MILVUS_MINIO_USER_NAME / MILVUS_MINIO_PASSWORDDedicated MinIO credentials for Milvus

6.2 Variables that also exist in .env.local.example but are not read directly by compose-local

These are mostly there so you can copy from one aggregated local sample into api/.env, celery-worker/.env, and web/.env when configuring your machine:

  • POSTGRES_DB_URL
  • MILVUS_CLUSTER_ENDPOINT
  • MILVUS_TOKEN
  • FILE_SYSTEM_SERVER_PUBLIC_URL
  • NEO4J_URI
  • REDIS_URL
  • All NEXT_PUBLIC_*
  • Most API / Worker runtime variables

6.3 Helper entries currently present in .env.local.example

VariableCurrent status
HF_ENDPOINTThe current project code and compose-local do not read it directly. It behaves more like a mirror helper for third-party model or download tooling.
  1. Start local infrastructure first with .env.local + docker-compose-local.yaml, or reuse the Postgres / Redis / Neo4j / MinIO / Milvus services already running on your machine.
  2. Then configure each service separately:
    • api/.env
    • celery-worker/.env
    • web/.env
    • hot-news/.env
  3. In a manual deployment, at minimum keep these cross-service variables consistent:
    • OAUTH_SECRET_KEY
    • POSTGRES_*
    • REDIS_*
    • MILVUS_*
    • NEO4J_*
    • FILE_SYSTEM_*
    • All encryption master keys

If you only want the smallest workable local path first, prioritize:

  • API: database / Redis / Milvus / Neo4j / file system / encryption master keys / SMTP / Tencent SMS / OAuth / Langfuse
  • Worker: database / Redis / Milvus / Neo4j / file system / encryption master keys / OAuth / Langfuse
  • Web: NEXT_PUBLIC_API_PREFIX / NEXT_PUBLIC_NOTIFICATION_WS_API_PREFIX / NEXT_PUBLIC_HOT_NEWS_API_PREFIX
  • Hot News: the defaults are usually enough to start directly
Last updated on