Skip to Content
OpenFlare
GuidesDeploymentReferenceArchitectureChangelog

Configuration

Supported configuration sources, fields, environment variables, and defaults across OpenFlare Server, frontend build, openflare-edge, openflare-dns, and openflared.


Config Sources

1. Server Config Sources

  • Config file: reads ./config.yaml at startup (override via CONFIG_PATH).
  • Env vars: every YAML field can be overridden via an UPPER_SNAKE_CASE env var (higher precedence than YAML).
  • System runtime config: stored in w_system_configs and dynamically hot-reloaded across workers and edge daemons.

2. Data-Plane & Edge Daemon Config Sources

  • CLI flags & env vars: openflare-edge, openflare-dns, and openflared are Rust binaries configured exclusively through CLI flags and env vars (no JSON/YAML main config files).
  • State directories: runtime identities, snapshots, and readiness markers are managed inside each component's --state-dir / --cache-dir.

Config and State File Locations

ComponentDefault LocationNotes
Server config file./config.yamlOverride via CONFIG_PATH
Server SQLite DBopenflare.dbOverride via database.sqlite_path / SQLITE_PATH
Edge state dir/var/lib/openflare-edgeSet via --state-dir / OPENFLARE_EDGE_STATE_DIR; stores identity.json, snapshot.json, bootstrap-token, ready.json
SmartDNS state dir/var/lib/openflare-dns (container) / data/smartdnsSet via --cache-dir / OPENFLARE_DNS_CACHE_DIR; stores identity.json, last-snapshot.bin, ready.json
SmartDNS GeoIP dir/var/lib/openflare-dns/geoip (container) / data/netintelSet via --geoip-dir / OPENFLARE_DNS_GEOIP_DIR
OpenFlared state dir/var/lib/openflaredSet via --state-dir / OPENFLARE_TUNNEL_STATE_DIR; stores connector-id, connector_identity.json, bootstrap-token

Server CLI Args

# Specify a config file when starting Server
CONFIG_PATH=/path/to/custom-config.yaml ./bin/openflare-server all

Supported subcommands:

  • all: runs API + Worker + Scheduler in one process (default).
  • api: runs control-plane HTTP/WebSocket API only.
  • worker: runs Asynq background worker only.
  • scheduler: runs cron scheduler only.
  • reset-passwd: resets an account password (--user, --password).
  • rotate-credentials: dry-runs (default) or transactionally re-encrypts (--apply) DB credentials before changing app.session_secret.

Server Env Vars vs Config File

Base settings live in config.yaml and accept UPPER_SNAKE_CASE env-var overrides.

1. App & Security Config (enable_webshell / app:)

YAML pathOverride env varDescriptionDefault
enable_webshellENABLE_WEBSHELLAllow Server to dispatch remote shell commands to edge nodes (startup-only)false
app.app_nameAPP_NAMEApplication identifieropenflare
app.envAPP_ENVRuntime mode (development / testing / production)production
app.addrAPP_ADDRHTTP bind address:3000
app.node_idAPP_NODE_IDSnowflake node ID (0-1023); must be unique per replica1
app.api_prefixAPP_API_PREFIXAdmin & API route prefix/api
app.graceful_shutdown_timeoutAPP_GRACEFUL_SHUTDOWN_TIMEOUTShutdown wait timeout (seconds)30
app.session_cookie_nameAPP_SESSION_COOKIE_NAMESession cookie nameopenflare_session_id
app.session_secretAPP_SESSION_SECRETSession signing & DB secret encryption key (production requires long random key; MCP needs >= 32 bytes)none (random)
app.session_domainAPP_SESSION_DOMAINCookie scope domainempty
app.session_ageAPP_SESSION_AGEBrowser session lifetime (seconds)86400 (24h)
app.session_http_onlyAPP_SESSION_HTTP_ONLYEnable cookie HttpOnly flagfalse
app.session_secureAPP_SESSION_SECUREEnable cookie Secure flag (HTTPS)false

2. Relational DB Config (database:)

YAML pathOverride env varDescriptionDefault
database.enabledDB_ENABLEDEnable PostgreSQL (false uses SQLite)true
database.sqlite_pathSQLITE_PATHSQLite file pathopenflare.db
database.hostDB_HOSTPostgreSQL host127.0.0.1
database.portDB_PORTPostgreSQL port5432
database.usernameDB_USERNAMEPostgreSQL usernameopenflare
database.passwordDB_PASSWORDPostgreSQL passwordreplace-with-strong-password
database.databaseDB_NAMEPostgreSQL database nameopenflare
database.max_idle_connDB_MAX_IDLE_CONNMax idle pool connections16
database.max_open_connDB_MAX_OPEN_CONNMax open pool connections128
database.conn_max_lifetime-Max connection lifetime (seconds)1800
database.conn_max_idle_time-Max idle time (seconds)600
database.log_levelDB_LOG_LEVELGORM SQL log level (info / warn / error / silent)info
database.ssl_modeDB_SSL_MODEPostgreSQL SSL modedisable
database.time_zoneDB_TIMEZONESession timezoneUTC
database.application_name-DB application identifieropenflare-server
database.search_path-PostgreSQL schema search pathpublic
database.prefer_simple_protocol-Prefer simple query protocolfalse
database.statement_cache_capacity-Prepared statement cache capacity256
database.default_query_exec_mode-Query execution modecache_statement
database.slow_threshold-Slow query threshold200ms

SQLite file DBs automatically enable WAL mode on startup (memory retains its mode); ensure directory write permission for -wal/-shm files and use the admin database export endpoint rather than copying live .db files directly.

3. Redis Config (redis:)

YAML pathOverride env varDescriptionDefault
redis.enabledREDIS_ENABLEDEnable Redis (required for async queues and sync)true
redis.addrsREDIS_ADDRServer or cluster addresses (env sets single address)["127.0.0.1:6379"]
redis.usernameREDIS_USERNAMERedis usernameempty
redis.passwordREDIS_PASSWORDRedis passwordempty
redis.dbREDIS_DBRedis DB index0
redis.cluster_mode-Enable Redis cluster modefalse
redis.master_name-Sentinel master nameempty
redis.key_prefixREDIS_KEY_PREFIXKey prefixopenflare:
redis.pool_sizeREDIS_POOL_SIZEPool size100
redis.min_idle_conn-Min idle connections10
redis.dial_timeout-Dial timeout (seconds)5
redis.read_timeout-Read timeout (seconds)3
redis.write_timeout-Write timeout (seconds)3
redis.max_retries-Max command retries3
redis.pool_timeout-Pool wait timeout (seconds)4
redis.conn_max_idle_time-Max idle time (seconds)300
redis.maint_notificationsREDIS_MAINT_NOTIFICATIONSRedis maintenance notifications handshake; keep off if compatibility is uncertainfalse

4. ClickHouse Config (clickhouse:)

Note: Client settings below connect Server to ClickHouse. For small-host ClickHouse tuning, mount ./config/clickhouse/performance.xml to /etc/clickhouse-server/config.d/performance.xml (see Start the Server).

YAML pathOverride env varDescriptionDefault
clickhouse.enabledCLICKHOUSE_ENABLEDEnable ClickHouse analytics/metrics backend (auto-enabled by CLICKHOUSE_HOST)false
clickhouse.hostsCLICKHOUSE_HOSTCluster addresses (env sets single address)["127.0.0.1:9000"]
clickhouse.usernameCLICKHOUSE_USERNAMEUsernamedefault
clickhouse.passwordCLICKHOUSE_PASSWORDPasswordreplace-with-clickhouse-password
clickhouse.databaseCLICKHOUSE_NAMEDatabase nameopenflare
clickhouse.max_idle_conn-Idle pool connections8
clickhouse.max_open_conn-Max open connections16
clickhouse.conn_max_lifetime-Max connection lifetime (seconds)3600
clickhouse.dial_timeout-Dial timeout (seconds)5
clickhouse.block_buffer_size-Native-protocol block buffer rows32

5. System Log Config (log:)

YAML pathOverride env varDescriptionDefault
log.levelLOG_LEVELLog level (debug / info / warn / error / fatal)info
log.formatLOG_FORMATFormat (console / json)console
log.outputLOG_OUTPUTOutput target (stdout / file)stdout
log.file_path-File path when output is file./logs/app.log
log.max_size-Max log file size (MB) before rotation100
log.max_age-Max retention days for rotated files30
log.max_backups-Max rotated backups to retain10
log.compress-Compress rotated files with gziptrue

Runtime logs emitted by Server, openflare-edge, workers, and schedulers stay in English regardless of UI locale, while console errors and task details localize dynamically (see Runtime Language & Internationalization).

6. Async Task Worker Config (worker:)

YAML pathOverride env varDescriptionDefault
worker.concurrencyWORKER_CONCURRENCYMax concurrent worker goroutines20
worker.strict_priorityWORKER_STRICT_PRIORITYEnforce strict priority queue schedulingfalse
worker.queues-Queue weightswebhook: 10, whitelist_only: 5, default: 3

7. Tracing OpenTelemetry Config (otel:)

YAML pathOverride env varDescriptionDefault
otel.export_protocolOTEL_EXPORTER_OTLP_TRACES_PROTOCOL / OTEL_EXPORTER_OTLP_PROTOCOLOTLP protocol (grpc / http/protobuf)grpc
otel.sampling_rateOTEL_SAMPLING_RATETrace sampling ratio (0.0 disabled, 1.0 full)0.0
otel.tracer_nameOTEL_TRACER_NAMETracer instrumentation namegithub.com/Rain-kl/OpenFlare

8. Embedded SmartDNS Config (smartdns:)

YAML pathOverride env varDescriptionDefault
smartdns.enabledSMARTDNS_ENABLEDEnable embedded or supervised local SmartDNS engine in Serverfalse
smartdns.listen_addrSMARTDNS_LISTEN_ADDRLocal authoritative DNS UDP/TCP bind address:53
smartdns.binary_pathSMARTDNS_BINARY_PATHOptional path to openflare-dns; uses embedded Go engine when empty""
smartdns.embedded_nameSMARTDNS_EMBEDDED_NAMEDisplay name for the embedded instanceEmbedded SmartDNS
smartdns.data_dirSMARTDNS_DATA_DIRData directory for embedded SmartDNS statedata/smartdns

System Runtime Config (SystemConfig)

Stored in w_system_configs and dynamically invalidated across replicas and nodes via Redis.

1. Basic & Business Runtime Config

KeyTypeDescriptionDefault
site_namestringPlatform display nameOpenFlare
server_addressstringPublic console URL for OAuth redirects and node install scriptsempty
automation_public_urlstringPublic HTTPS URL for CLI & MCP (empty disables MCP/automation)""
password_login_enabledboolAllow username/password logintrue
registration_enabledboolAllow self-service user registrationfalse
password_register_enabledboolAllow direct frontend email/password sign-upfalse
oidc_login_enabledboolEnable OIDC (SSO) sign-intrue
max_api_keys_per_userintMax personal access tokens per user5
login_session_ttl_hoursintBrowser cookie session lifetime (hours; 0 = browser session)0
upload_allowed_extensionsstringComma-separated allowed upload extensions (empty = unlimited)jpg,png,webp
file_access_whitelistjsonUpload categories accessible without authentication["avatar"]
disk_cache_max_size_mbintLocal disk cache threshold (MB)100
disk_cache_ttl_minutesintDefault cache entry TTL (minutes)60
disk_cache_lru_enabledboolEvict oldest entries via LRU when threshold exceededtrue
update_upstream_repositorystringGitHub repository checked for updatesRain-kl/OpenFlare
storage_configjsonLocal disk or AWS S3-compatible upload storage configurationlocal storage
tunnel_update_repostringRelease repository checked by openflared"Rain-kl/OpenFlare"
tunnel_heartbeat_intervalintTunnel connector and relay heartbeat interval (ms)5000
tunnel_lease_ttl_secondsintRelay scheduling lease TTL (seconds)30
tunnel_default_ha_relaysintDefault HA relay count for new relay pools2
search_engine_indexing_enabledboolAllow search engine indexingfalse
menu_display_configstringMenu visibility override map ({url: enabled}){}
pages_max_package_size_mbintPages archive upload limit (1–2048 MiB)100
pages_max_history_countintMax retained Pages deployments per project (0 = unlimited)20

2. Human Verification (PoW Captcha)

KeyTypeDescriptionDefault
cap_login_enabledboolRequire PoW captcha on console loginfalse
cap_auto_solveboolSolve login captcha automatically in backgroundtrue
cap_challenge_countintNumber of challenges per verification (1–5)1
cap_challenge_difficultyintPoW hash difficulty (3–5)4
cap_challenge_sizeintChallenge salt byte length32
cap_challenge_ttl_secondsintChallenge lifetime (seconds)600
cap_token_ttl_secondsintVerified login token TTL (seconds)1200

3. SMTP Mail Config

KeyTypeDescriptionDefault
smtp_hoststringOutbound SMTP hostempty
smtp_portintOutbound SMTP port (465 SSL / 587 STARTTLS)465
smtp_usernamestringSMTP account usernameempty
smtp_passwordstringSMTP secret (masked after save)empty
email_login_verification_enabledboolRequire 6-digit email verification code on loginfalse
email_register_verification_enabledboolRequire email verification code on self-registrationfalse

4. Edge Node, SmartDNS & Network Intelligence Config

KeyTypeDescriptionDefault
agent_discovery_tokenstringGlobal discovery token for initial openflare-edge enrollmentauto-generated
agent_heartbeat_intervalintHeartbeat interval pushed to openflare-edge nodes (ms)3000 (3s)
agent_websocket_upgrade_enabledboolAllow openflare-edge WebSocket control channel upgradetrue
node_offline_thresholdintTimeout before marking nodes offline (ms)60000 (60s)
agent_update_repostringRelease repository checked by openflare-edge auto-updateRain-kl/OpenFlare
geoip_providerstringDefault WAF GeoIP lookup provideripinfo
smartdns_enabledboolEnable authoritative SmartDNS featuretrue
smartdns_delegation_domainstringGlobal delegation zone domain (e.g. edge.example.com)""
smartdns_ns_hostsjsonAuthoritative NS hostnames (JSON array)[]
smartdns_default_ttlintDefault SmartDNS answer TTL (seconds)60
smartdns_discovery_tokenstringStandalone openflare-dns auto-discovery token""
smartdns_snapshot_interval_secondsintBinary snapshot refresh interval (seconds)10
smartdns_update_repostringRelease repository checked by openflare-dnsRain-kl/OpenFlare
netintel_data_dirstringLocal storage directory for GeoIP/BGP datadata/netintel
netintel_geoip_sourcestringNetwork intelligence feed sourcefyralabs
netintel_bgptools_user_agentstringUser-Agent sent to bgp.toolsOpenFlare-NetIntel/1.0 (+https://github.com/Rain-kl/OpenFlare)
netintel_caida_enabledboolEnable CAIDA AS relationship enrichmentfalse
netintel_auto_probe_enabledboolEnable periodic inter-node quality probingtrue

5. Uptime Kuma Monitoring Sync

KeyTypeDescriptionDefault
uptime_kuma_enabledboolEnable background diff-sync to Uptime Kumafalse
uptime_kuma_urlstringUptime Kuma base URLempty
uptime_kuma_usernamestringUptime Kuma admin usernameempty
uptime_kuma_passwordstringUptime Kuma admin password (masked after save)empty
uptime_kuma_monitor_scopestringMonitor scope (all or selected)all
uptime_kuma_selected_sitesstringComma-separated site names when selectedempty
uptime_kuma_sync_intervalintSync cadence (minutes)5
uptime_kuma_intervalintProbe check interval (seconds)60
uptime_kuma_retryintRetries before marking down0
uptime_kuma_retry_intervalintDelay between retries (seconds)60
uptime_kuma_timeoutintProbe request timeout (seconds)48

6. Edge Security, Rate Limits & Built-in Pages

Edge proxy parameters are distributed from console Performance Policies (see Performance Policies). The following defaults and edge response templates are included in distributed snapshots:

KeyTypeDescriptionDefault
edge_trusted_proxy_cidrsstringJSON array of CIDRs trusted to supply CF-Connecting-IP ([] disables trust)22 Cloudflare official ranges
edge_default_limit_conn_per_serverintDefault max concurrent connections per site (0 disabled)0
edge_default_limit_conn_per_ipintDefault max concurrent connections per IP (0 disabled)0
edge_default_limit_ratestringDefault bandwidth cap per request (e.g. 512k; empty disables)empty
edge_default_limit_req_per_ipstringDefault per-IP request rate limit (e.g. 10r/s; empty disables)empty
pow_pagejsonPoW challenge page preset/widget & custom HTML configuration{"template":"shield","widget":"progress"}
site_auth_htmlstringCustom HTML template for site password/auth prompt""
sw_offline_enabledboolEnable Service Worker offline fallback pagefalse
sw_offline_htmlstringCustom offline contact HTML (empty uses built-in template)""
sw_offline_domainsjsonJSON array of domains served by offline fallback[]

7. Origin Error Page

Applies to reverse-proxy routes only (see Origin Error Page Design).

KeyTypeDescriptionDefault
origin_error_page_enabledboolReplace matched error bodies while preserving HTTP status codetrue
origin_error_page_get_onlyboolRestrict custom error pages to GET requestsfalse
origin_error_page_status_codesjsonJSON list of single codes or lo-hi ranges within 400-599["500-599"]
origin_error_page_htmlstringCustom HTML ({{status}}, {{host}}; max 256 KiB)empty

8. Log Database

KeyTypeDescriptionDefault
log_databasestringActive log backend (postgres / sqlite / clickhouse; internal protected key)follows primary / clickhouse
log_db_migrationstringMigration freeze flag (internal protected key; migrating rejects log writes with 503)empty
log_retention_days_postgresintPostgreSQL access log retention (days)30
log_retention_days_sqliteintSQLite access log retention (days)30
log_retention_days_clickhouseintClickHouse access log retention (days)30
metric_retention_daysintNode telemetry retention across all backends (days)3

Frontend Build Env Vars

Env varPurposeDefault
WAVELET_BACKEND_URLSSR and dev-proxy backend URLhttp://localhost:3000
NEXT_PUBLIC_WAVELET_BACKEND_URLBrowser API backend URL (empty = same origin)empty
NEXT_PUBLIC_APP_VERSIONFrontend version displaydev

OpenFlare Edge Flags & Env Vars

openflare-edge run supports these CLI flags and container entrypoint environment variables:

CLI FlagContainer Env VarDescription & Default
--server-urlOPENFLARE_EDGE_SERVER_URLControl-plane URL (required)
--token-typeOPENFLARE_EDGE_TOKEN_TYPEdiscovery (default) or node
--token-fileOPENFLARE_EDGE_TOKEN_FILEPath to auth token file (OPENFLARE_EDGE_TOKEN writes this file in Docker)
--state-dirOPENFLARE_EDGE_STATE_DIRPersistent state dir (Docker default /var/lib/openflare-edge)
--http-listenOPENFLARE_EDGE_HTTP_LISTENHTTP bind socket (127.0.0.1:8080 CLI, 0.0.0.0:8080 Docker, 0.0.0.0:80 installer)
--tls-listenOPENFLARE_EDGE_TLS_LISTENHTTPS bind socket (0.0.0.0:8443 Docker, 0.0.0.0:443 installer)
--upgrade-Enforce active snapshot recovery during upgrades

OpenFlare DNS Flags & Env Vars

openflare-dns serve supports matching OPENFLARE_DNS_* environment variables:

CLI FlagEnv VarDescription & Default
--controller-urlOPENFLARE_DNS_CONTROLLER_URL (fallback OPENFLARE_SERVER_URL)Control-plane URL (required)
--tokenOPENFLARE_DNS_TOKENDedicated instance token
--discovery-tokenOPENFLARE_DNS_DISCOVERY_TOKENAuto-discovery enrollment token
--token-fileOPENFLARE_DNS_TOKEN_FILEPath to token file
--token-typeOPENFLARE_DNS_TOKEN_TYPEToken type (discovery default)
--instance-idOPENFLARE_DNS_INSTANCE_IDExplicit instance ID override
--nameOPENFLARE_DNS_NAMEInstance display name (Standalone SmartDNS)
--listenOPENFLARE_DNS_LISTENUDP/TCP DNS listen socket (0.0.0.0:53, container 0.0.0.0:5353)
--public-addrOPENFLARE_DNS_PUBLIC_ADDRPublic IP/address reported to controller
--geoip-dirOPENFLARE_DNS_GEOIP_DIRGeoIP database directory (data/netintel, container /var/lib/openflare-dns/geoip)
--cache-dirOPENFLARE_DNS_CACHE_DIRSnapshot and identity directory (data/smartdns, container /var/lib/openflare-dns)
--workersOPENFLARE_DNS_WORKERSWorker thread count (0 = auto)
--rrl-qps / --rrl-burstOPENFLARE_DNS_RRL_QPS / OPENFLARE_DNS_RRL_BURSTResponse rate limits (1000 QPS / 2000 burst)
--snapshot-interval-secsOPENFLARE_DNS_SNAPSHOT_INTERVAL_SECSSnapshot poll interval (10s)

OpenFlared Flags & Env Vars

CLI flags and env vars supported by the Rust openflared binary:

CLI FlagEnv VarDescription & Default
--server-urlOPENFLARE_SERVER_URLControl-plane URL (required)
--token / --token-fileOPENFLARE_TUNNEL_TOKEN / OPENFLARE_TUNNEL_TOKEN_FILETunnel token or token file
--bootstrap-tokenOPENFLARE_TUNNEL_BOOTSTRAP_TOKENTunnel bootstrap token
--state-dirOPENFLARE_TUNNEL_STATE_DIRPersistent state dir (/var/lib/openflared)
--connector-idOPENFLARE_CONNECTOR_IDOptional connector ID override

On this page