Skip to content

Local search · English

    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.

    • Keep the environment outside the public asset tree and restrict file permissions. Preserve the existing secret key during upgrades and restores.
    1. Set all required values before starting a deployed service:

      STRUKT_ORIGIN=https://admin.example.com
      STRUKT_PUBLIC_ORIGIN=https://sites.example.net
      STRUKT_DATA_DIR=/var/lib/strukt
      STRUKT_SETUP_CODE=REPLACE_WITH_RANDOM_SETUP_CODE
      STRUKT_ANALYTICS_SALT=REPLACE_WITH_RANDOM_SECRET_AT_LEAST_32_CHARACTERS
      STRUKT_SECRET_KEY=REPLACE_WITH_BASE64_OF_EXACTLY_32_RANDOM_BYTES
      STRUKT_ANALYTICS_GEO=false

      The 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.

    2. Generate independent random values locally with a trusted cryptographic generator. For example, openssl rand -base64 32 produces 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.

    3. Review core optional values:

      Variable Default / validation
      PORT, STRUKT_PUBLIC_PORT 3000 / 3100; integers 1–65535
      STRUKT_HOST, STRUKT_PUBLIC_HOST 127.0.0.1
      DATABASE_URL absent: SQLite; otherwise PostgreSQL URL with host/database
      DATABASE_POOL_MAX 16; integer 2–500 per process
      DATABASE_SITE_IDLE_MS 60000; integer 1000–300000
      STRUKT_METRICS_INTERVAL_MS 60000; 0 disables reports, otherwise 1000–300000
      STRUKT_BETA_CODE absent: general registration closed
      STRUKT_EXPORT_DIR absent: per-site export directory
      STRUKT_DIST_DIR optional source-server asset override
    4. 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.

    5. 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.

    • Startup accepts the complete configuration, secrets remain private and a restart preserves decryption of existing credentials.

    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.

    Applies to Strukt c02552848c92 · 2026-10-31