Skip to main content

Environment Variables

Tianji supports various environment variables to customize its behavior. You can configure these variables in your docker compose env field or through your deployment environment.

Basic Configuration

VariableDescriptionDefaultExample
PORTServer port123453000
JWT_SECRETSecret for JWT tokensRandom Textyour-secret-key
ALLOW_REGISTEREnable user registrationfalsetrue
ALLOW_OPENAPIEnable OpenAPI accesstruefalse
WEBSITE_IDWebsite identifier-your-website-id
DISABLE_AUTO_CLEARDisable automatic data cleanupfalsetrue
DISABLE_ACCESS_LOGSDisable access logsfalsetrue
DB_DEBUGEnable database debuggingfalsetrue
ALPHA_MODEEnable alpha featuresfalsetrue
ENABLE_FUNCTION_WORKEREnable function workerfalsetrue
REGISTER_AUTO_JOIN_WORKSPACE_IDAuto-join workspace ID for new users-workspace-id-123

Cache Configuration

VariableDescriptionDefaultExample
CACHE_MEMORY_ONLYUse memory-only cachingfalsetrue
REDIS_URLRedis connection URL-redis://localhost:6379

Authentication

VariableDescriptionDefaultExample
DISABLE_ACCOUNTDisable account-based authenticationfalsetrue
AUTH_SECRETAuthentication secretMD5 of JWT secretyour-auth-secret
AUTH_RESTRICT_EMAILRestrict registration to specific email domains-@example.com
AUTH_USE_SECURE_COOKIESUse secure cookies for authenticationfalsetrue

Email Authentication and Email Invitation

VariableDescriptionDefaultExample
EMAIL_SERVERSMTP server for email-smtp://user:[email protected]:587
EMAIL_FROMEmail sender address-[email protected]

GitHub Authentication

VariableDescriptionDefaultExample
AUTH_GITHUB_IDGitHub OAuth client ID-your-github-client-id
AUTH_GITHUB_SECRETGitHub OAuth client secret-your-github-client-secret

Google Authentication

VariableDescriptionDefaultExample
AUTH_GOOGLE_IDGoogle OAuth client ID-your-google-client-id
AUTH_GOOGLE_SECRETGoogle OAuth client secret-your-google-client-secret

Custom OAuth/OIDC Authentication

VariableDescriptionDefaultExample
AUTH_CUSTOM_IDCustom OAuth/OIDC client ID-your-custom-client-id
AUTH_CUSTOM_SECRETCustom OAuth/OIDC client secret-your-custom-client-secret
AUTH_CUSTOM_NAMECustom provider nameCustomEnterprise SSO
AUTH_CUSTOM_TYPEAuthentication typeoidcoauth
AUTH_CUSTOM_ISSUEROIDC issuer URL-https://auth.example.com

AI Features

VariableDescriptionDefaultExample
SHARED_OPENAI_API_KEYOpenAI API key-your-openai-api-key
SHARED_OPENAI_BASE_URLCustom OpenAI API URL-https://api.openai.com/v1
SHARED_OPENAI_MODEL_NAMEOpenAI model to usegpt-4ogpt-3.5-turbo
SHARED_OPENAI_TOKEN_CALC_CONCURRENCYToken calculation concurrency510
DEBUG_AI_FEATUREDebug AI featuresfalsetrue

ClickHouse Configuration

VariableDescriptionDefaultExample
CLICKHOUSE_URLClickHouse database URL-http://localhost:8123
CLICKHOUSE_USERClickHouse username-default
CLICKHOUSE_PASSWORDClickHouse password-your-password
CLICKHOUSE_DATABASEClickHouse database name-tianji
CLICKHOUSE_DEBUGEnable ClickHouse debuggingfalsetrue
CLICKHOUSE_DISABLE_SYNCDisable ClickHouse synchronizationfalsetrue
CLICKHOUSE_SYNC_BATCH_SIZESynchronization batch size100005000
CLICKHOUSE_ENABLE_FALLBACKEnable ClickHouse fallbacktruefalse
CLICKHOUSE_HEALTH_CHECK_INTERVALHealth check interval (ms)3000060000
CLICKHOUSE_MAX_CONSECUTIVE_FAILURESMaximum consecutive failures35
CLICKHOUSE_RETRY_INTERVALRetry interval (ms)500010000

Billing System (LemonSqueezy)

VariableDescriptionDefaultExample
ENABLE_BILLINGEnable billing functionalityfalsetrue
LEMON_SQUEEZY_SIGNATURE_SECRETLemonSqueezy webhook signature secret-your-signature-secret
LEMON_SQUEEZY_API_KEYLemonSqueezy API key-your-api-key
LEMON_SQUEEZY_STORE_IDLemonSqueezy store ID-your-store-id
LEMON_SQUEEZY_SUBSCRIPTION_FREE_IDFree tier subscription variant ID-free-variant-id
LEMON_SQUEEZY_SUBSCRIPTION_PRO_IDPro tier subscription variant ID-pro-variant-id
LEMON_SQUEEZY_SUBSCRIPTION_TEAM_IDTeam tier subscription variant ID-team-variant-id

Sandbox Configuration

VariableDescriptionDefaultExample
USE_VM2Use VM2 for sandbox executionfalsetrue
SANDBOX_MEMORY_LIMITMemory limit for sandbox (MB)1632
PUPPETEER_EXECUTABLE_PATHCustom path to Puppeteer executable-/usr/bin/chromium

Maps Integration

VariableDescriptionDefaultExample
AMAP_TOKENAMap (Gaode) API token-your-amap-token
MAPBOX_TOKENMapbox API token-your-mapbox-token

Telemetry

VariableDescriptionDefaultExample
DISABLE_ANONYMOUS_TELEMETRYDisable anonymous telemetryfalsetrue
CUSTOM_TRACKER_SCRIPT_NAMECustom tracker script name-custom-tracker.js

Setting Environment Variables

You can set these environment variables in different ways:

  1. Set them directly in your deployment environment (Docker, Kubernetes, etc.)

  2. For Docker deployments, you can use environment variables in your docker-compose.yml:

services:
tianji:
image: moonrailgun/tianji:latest
environment:
- PORT=3000
- ALLOW_REGISTER=true

Boolean Values

For boolean environment variables, you can use either "1" or "true" to enable the feature, and either omit the variable or set it to any other value to disable it.