Skip to content

Configuration

Arqen applications are configured through environment variables and optional configuration files.

Environment variables

VariableDescriptionDefault
ARQEN_HOSTBind address for the HTTP server127.0.0.1
ARQEN_PORTPort for the HTTP server8888
ARQEN_STORAGE_MODEStorage mode: memory, native, persistent, http, or cloudmemory
ARQEN_PERSISTENT_PATHNative durable thingd storage pathunset; required for persistent
ARQEN_THINGD_URLthingd HTTP service URLunset; required for http
ARQEN_CLOUD_URLFuture public thingd.cloud endpointunset; cloud mode is not implemented
ARQEN_THINGD_AUTH_TOKENServer-side thingd/cloud bearer tokenunset; never log or commit
ARQEN_THINGD_ENCRYPTION_KEY64-hex-character native Thingd encryption keyunset; server-side only
ARQEN_THINGD_SCHEMA_PATHVersioned .thingd schema pathunset
ARQEN_SYNC_ENABLEDEnable opt-in Thingd source-to-replica syncfalse
ARQEN_SYNC_MODESync capability: disabled, http, or nativedisabled
ARQEN_SYNC_SOURCE_IDStable source instance identifierunset
ARQEN_SYNC_TARGET_URLThingd replication target URLunset; required when enabled
ARQEN_SYNC_TARGET_AUTH_TOKENTarget bearer credentialunset; required by target policy
ARQEN_SYNC_COLLECTIONSComma-separated replication allowlistempty
ARQEN_SYNC_REPLICATE_ALLExplicitly replicate all supported application collectionsfalse
ARQEN_SYNC_POLL_INTERVALSync polling interval in seconds5
ARQEN_SYNC_BATCH_SIZEMaximum changes per replication page500
ARQEN_SYNC_SNAPSHOT_FALLBACKBootstrap stale replicas from a snapshottrue
ARQEN_JWT_SECRETJWT secret, kept redacted in configuration outputunset
ARQEN_API_KEY_HEADERAPI-key request headerX-API-Key
ARQEN_LOG_LEVELLog levelinfo
ARQEN_LOG_FORMATLog format (pretty, json, compact)pretty
ARQEN_WORKER_ENABLEDEnable workersimplementation default
ARQEN_WORKER_QUEUESComma-separated worker queuesimplementation default
ARQEN_WORKER_POLL_INTERVALWorker polling intervalimplementation default
ARQEN_WORKER_LEASE_SECONDSJob lease durationimplementation default
ARQEN_WORKER_MAX_RETRIESMaximum job retriesimplementation default
ARQEN_WORKER_CONCURRENCYWorker concurrencyimplementation default
ARQEN_HEALTH_CHECK_TIMEOUTDependency health-check timeoutimplementation default
ARQEN_HEALTH_STARTUP_DELAYStartup delay before health checksimplementation default
ARQEN_REQUEST_TIMEOUTHTTP request timeout30s
ARQEN_MAX_BODY_SIZEMaximum request body size1048576
ARQEN_SHUTDOWN_TIMEOUTGraceful shutdown timeout10s

ARQEN_CONFIG_FILE is also recognized by arqen check and selects the file used for configuration validation. It is a CLI diagnostic variable rather than a runtime configuration field.

Configuration file

Arqen supports an optional arqen.toml configuration file. Use the --file flag to specify a custom path (default: arqen.toml in the current directory).

Config file discovery

  1. If --file <path> is passed, load from that path.
  2. Otherwise, look for arqen.toml in the current working directory.
  3. If the file does not exist, proceed with defaults and env vars.
  4. If the file exists but cannot be parsed, exit with a configuration error.

Example arqen.toml

toml
[server]
host = "127.0.0.1"
port = 8888

[logging]
level = "info"
format = "pretty"  # or "json"

[storage]
mode = "memory"
# persistent_path = "/var/lib/my-app/data"  # required for native/persistent
# http_url = "http://localhost:8080"        # required for http mode
# auth_token = "server-side-secret"         # prefer ARQEN_THINGD_AUTH_TOKEN
# encryption_key = ""                        # prefer ARQEN_THINGD_ENCRYPTION_KEY
# schema_path = "schema.thingd"

[sync]
enabled = false
# mode = "http" # disabled, http, or native; native requires storage.mode = "native"
# source_id = "local-instance"
# target_url = "https://thingd-replica.internal"
# collections = ["watchloom_titles"]
# replicate_all = false
# snapshot_fallback = true

Storage modes

Memory mode (default)

  • In-memory thingd engine
  • Process-local and disposable
  • No external dependencies
  • Suitable for development, testing, and prototypes

HTTP mode

  • Connects to a thingd service via HTTP
  • Requires ARQEN_THINGD_URL or storage.http_url configuration
  • Suitable for production deployments

Native mode

  • Embedded persistent thingd with no separate HTTP service
  • Requires persistent_path
  • persistent is retained as a compatibility alias for native
  • The path must be writable and backed up by the deployment owner

Cloud mode

cloud is reserved for a future versioned public thingd.cloud adapter. It fails explicitly today; Arqen never silently falls back to memory.

Precedence chain

Configuration is loaded in order of precedence (highest wins):

  1. CLI flags (--host, --port, --log, --storage on dev/start; --file on dev, start, and up)
  2. Environment variables (ARQEN_*)
  3. Config file (arqen.toml)
  4. Defaults

A value set at a higher layer overrides the same value at a lower layer. For example, ARQEN_PORT=9000 overrides port = 8888 in arqen.toml, which overrides the compiled default of 8888.

Startup banner

When an Arqen application starts, it prints a banner with essential information:

text
Arqen v0.5.0
API:    http://127.0.0.1:8888
Health: http://127.0.0.1:8888/health
Docs:   http://127.0.0.1:8888/docs
Agent:  http://127.0.0.1:8888/agent
Storage: memory

The banner includes:

  • Application version
  • Bound API URL
  • Health endpoint URL
  • Docs endpoint URL
  • Agent endpoint URL
  • Storage mode (memory, native, persistent, or http)

Development mode (arqen dev) uses pretty logging. Production mode (arqen start) uses JSON logging. arqen dev does not include an integrated file watcher. Call AppConfig::validate_production() from a production bootstrap to reject memory storage, disabled authentication, and pretty logs.

Rust-first implementation · language-agnostic application positioning