Skip to content

Configuration ​

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

open-envault ​

Arqen can load encrypted environments once during startup through the optional open-envault integration. It is disabled by default. Enable it with an [oenv] section. Decrypted values remain in memory and are never written to a plaintext file.

toml
[oenv]
enabled = true
environment = "dev"
project_file = "open-envault.yaml"
required = false
executable = "oenv"

Required mode fails startup when the environment cannot be loaded. Use arqen secrets check or arqen secrets doctor for redacted diagnostics.

Environment variables ​

VariableDescriptionDefault
ARQEN_HOSTBind address for the HTTP server127.0.0.1
ARQEN_OENV_ENABLEDEnable encrypted open-envault startup loadingfalse
ARQEN_OENV_ENVIRONMENTopen-envault environment namedev
ARQEN_OENV_PROJECT_FILEopen-envault project fileopen-envault.yaml
ARQEN_OENV_REQUIREDFail startup when the environment cannot be loadedfalse
ARQEN_OENV_EXECUTABLEoenv executable used for diagnostics/fallbackoenv
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_NATIVE_BACKENDNative engine: rocksdb or experimental thingdbrocksdb
ARQEN_THINGD_URLthingd HTTP service URLunset; required for http
ARQEN_THINGD_MAX_CONCURRENCYMaximum active HTTP Thingd requests16
ARQEN_THINGD_REQUEST_TIMEOUTHTTP Thingd request timeout in seconds30
ARQEN_THINGD_MAX_RETRIESMaximum retries for safe/transient Thingd requests2
ARQEN_THINGD_MAX_RETRY_DURATIONMaximum total retry duration in seconds30
ARQEN_THINGD_MAX_QUERY_SCAN_OBJECTSMaximum objects an HTTP range query may scan100000
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_THINGD_CACHE_ENABLEDEnable the allowlisted catalog read cachefalse
ARQEN_THINGD_CACHE_COLLECTIONSComma-separated collections permitted in the cacheunset; required when enabled
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_REQUEST_LOG_LEVELRequest log level (trace/debug/info/warn/error) for 2xxinfo
ARQEN_LOG_FORMATLog format (pretty, json, compact)pretty
ARQEN_SERVICE_NAMEStable service name included in structured request logspackage name
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_REQUEST_LOG_SAMPLE_RATESuccessful request log sample rate0.01
ARQEN_SLOW_REQUEST_THRESHOLD_MSAlways-log request duration threshold250
ARQEN_COMPRESSION_THRESHOLDMinimum response size for gzip/Brotli compression (bytes)1024
ARQEN_COMPRESSION_ENABLEDEnable gzip/Brotli response compressiontrue
ARQEN_MAX_BODY_SIZEMaximum request body size1048576
ARQEN_SHUTDOWN_TIMEOUTGraceful shutdown timeout10s

ARQEN_CONFIG_FILE selects the configuration file for generated applications and for arqen check. The explicit --file CLI flag remains the preferred way to select a file from the Arqen CLI.

RUST_LOG overrides ARQEN_LOG_LEVEL when present. Local development uses compact logs by default; choose pretty for diagnosis. Production should use JSON logs and a conservative application filter such as service=info,arqen=info; change the environment and restart the service to apply a new filter.

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
compression_enabled = true
compression_threshold = 1024

[logging]
level = "info"
request_level = "info"  # trace/debug/info/warn/error for 2xx; 4xx->warn, 5xx->error always
format = "pretty"  # or "json"

[storage]
mode = "memory"
# native_backend = "thingdb" # experimental Rust-native engine; default is rocksdb
# 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"
# cache_enabled = false
# cache_collections = ["catalog_titles", "catalog_genres"]

[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
  • The optional cache is catalog-only and requires an explicit collection allowlist. It must not include user- or tenant-scoped collections.

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
  • Production validation requires ARQEN_THINGD_SCHEMA_PATH for native mode; HTTP mode skips this requirement because the remote thingd service owns the schema.

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 v<current-version>
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 compact logging by default. Production mode (arqen start) uses JSON logging. For Rust hot reload, use cargo watch as a [[dev.services]] in arqen.toml and run arqen up (see hot-reload.md). Call AppConfig::validate_production() from a production bootstrap to reject memory storage, disabled authentication, and pretty logs.

Rust-first backend toolkit · explicit integrations for HTTP, jobs, and Thingd