Environment variable reference
Load runtime variables from an operator-owned private environment file using your service manager or shell. The source server and compiled server use the same validated server configuration. The example below uses fictitious hosts and explicit replacement values, not reusable credentials.
Before you start
Section titled “Before you start”- Keep the environment outside the public asset tree and restrict file permissions. Preserve the existing secret key during upgrades and restores.
-
Set all required values before starting a deployed service:
STRUKT_ORIGIN=https://admin.example.comSTRUKT_PUBLIC_ORIGIN=https://sites.example.netSTRUKT_DATA_DIR=/var/lib/struktSTRUKT_SETUP_CODE=REPLACE_WITH_RANDOM_SETUP_CODESTRUKT_ANALYTICS_SALT=REPLACE_WITH_RANDOM_SECRET_AT_LEAST_32_CHARACTERSSTRUKT_SECRET_KEY=REPLACE_WITH_BASE64_OF_EXACTLY_32_RANDOM_BYTESSTRUKT_ANALYTICS_GEO=falseThe two origins are exact HTTP(S) origins without a path/trailing slash. The hosted base needs a DNS hostname; admin must be outside that namespace. Geo lookup is explicitly disabled here for an offline first trial.
-
Generate independent random values locally with a trusted cryptographic generator. For example,
openssl rand -base64 32produces a candidate secret-key value; store its output privately in the environment, never in a public terminal transcript. Generate setup code and analytics salt separately. Remove setup enrollment after the first account is established. -
Review core optional values:
Variable Default / validation PORT,STRUKT_PUBLIC_PORT3000 / 3100; integers 1–65535 STRUKT_HOST,STRUKT_PUBLIC_HOST127.0.0.1 DATABASE_URLabsent: SQLite; otherwise PostgreSQL URL with host/database DATABASE_POOL_MAX16; integer 2–500 per process DATABASE_SITE_IDLE_MS60000; integer 1000–300000 STRUKT_METRICS_INTERVAL_MS60000; 0 disables reports, otherwise 1000–300000 STRUKT_BETA_CODEabsent: general registration closed STRUKT_EXPORT_DIRabsent: per-site export directory STRUKT_DIST_DIRoptional source-server asset override -
For analytics, STRUKT_ANALYTICS_RETENTION_DAYS defaults to 365 and accepts 1–3650. STRUKT_ANALYTICS_GEO accepts only true/false and defaults true; enabled lookup downloads/updates local GeoIP data. STRUKT_TRUSTED_PROXIES is an explicit IP/CIDR list for analytics forwarding resolution; absent means ignore forwarded client-IP headers.
-
Enable optional groups together. STRUKT_III_URL is an optional ws/wss engine URL. Account SMTP uses STRUKT_ACCOUNT_SMTP_HOST/PORT/SECURITY/USER/PASSWORD/FROM and optional FROM_NAME; partial groups fail validation, and remote recovery requires HTTPS. Domain admission uses STRUKT_DOMAIN_ADDRESSES plus optional RESERVED_HOSTS; its worker endpoint separately requires STRUKT_DOMAIN_WORKER_TOKEN (64 lowercase hex characters) and unused WORKER_PORT 1024–65535.
Check the result
Section titled “Check the result”- Startup accepts the complete configuration, secrets remain private and a restart preserves decryption of existing credentials.
Troubleshooting
Section titled “Troubleshooting”Fix malformed existing values explicitly. Never silently replace an encryption key to make startup pass. Website Forms mail, Store payments, workspace subscription credentials and operator account SMTP belong to separate configuration surfaces.
Related guides
Section titled “Related guides”- Install a self-hosted Strukt service
- SQLite and PostgreSQL operations
- Workers, reverse proxy and health checks
Applies to Strukt c02552848c92 · 2026-10-31