Skip to content
Documentation

ARXD environment

Rendered from the repository’s own documentation directory.

ARXD environment

Every variable the application reads, what it does, and how it is set today.

This file lists names and meanings only. It never contains a value for a secret. The values live in httpdocs/.env, which is 600, owned by the application user, and denied over HTTP by .htaccess.


1. How configuration is loaded

app/bootstrap.php parses .env as KEY=VALUE pairs and calls putenv() for each key only if the variable is not already set. Real environment variables therefore win, which is what lets a test run override a value without editing a file.

arxd_env($key, $default) reads a variable and coerces true, false and null strings into their types. An empty value is treated as unset, so PAYPAL_CLIENT_ID= means "not configured" rather than "set to empty string".

Core\Config and the BillingGateway implementations read through arxd_env(), never getenv() directly — one coercion path, one place to debug.


2. Application core

| Variable | Purpose | Current | | --- | --- | --- | | APP_NAME | Product name in titles and mail | set | | APP_ENV | production / local | production | | APP_DEBUG | Show exception detail in responses | false | | APP_URL | Absolute base for links and mail | set | | APP_TIMEZONE | PHP default timezone | UTC | | APP_KEY | Master key for Core\Crypt and token signing | set |

APP_KEY must be at least 32 bytes. Core\Crypt throws rather than degrade if it is missing or short — a silently-weak key would be worse than a crash.

APP_DEBUG=true on this host would print stack traces to customers. It is false and must stay false in production.


3. Database

| Variable | Purpose | Current | | --- | --- | --- | | DB_HOST | MariaDB host | localhost | | DB_PORT | Port | 3306 | | DB_DATABASE | Schema | ARXD | | DB_USERNAME | Application user | set | | DB_PASSWORD | Application password | set |

The application user is not the Plesk admin. Admin access is only needed for maintenance:

MYSQL_PWD="$(cat /etc/psa/.psa.shadow)" /usr/bin/mariadb -uadmin -D ARXD -e "…"

Core\Database connects with PDO::ATTR_EMULATE_PREPARES => false, so bound parameters are real server-side parameters.


4. Sessions and authentication

| Variable | Purpose | Current | | --- | --- | --- | | SESSION_COOKIE | Cookie name | set | | SESSION_LIFETIME | Idle timeout, seconds | set | | SESSION_SECURE | Secure flag on the cookie | true | | SESSION_DOMAIN | Cookie domain | set | | ARGON_MEMORY | Argon2id memory cost | set | | ARGON_TIME | Argon2id time cost | set | | LOGIN_MAX_ATTEMPTS | Attempts before lockout | 6 | | LOGIN_DECAY_SECONDS | Lockout window | 900 | | REQUIRE_2FA_FOR_STAFF | Force TOTP for platform staff | false | | TRUSTED_PROXIES | Proxies whose X-Forwarded-For is trusted | set |

SESSION_SECURE=true means a cookie is never sent over plain HTTP. Turning it off "to debug" on a live host silently downgrades every session.

REQUIRE_2FA_FOR_STAFF is false today. This is a real gap, not a preference: platform staff accounts are the highest-privilege accounts on the system and they are not required to hold a second factor. Flipping it requires every staff member to enrol first, in order, or they lock themselves out.


5. Branding

BRAND_COMPANY, BRAND_SUBSIDIARY, BRAND_PARENT, BRAND_LEGAL_ENTITY, BRAND_SUPPORT_EMAIL, BRAND_SALES_EMAIL, BRAND_PHONE, BRAND_PHONE_HOURS, BRAND_ADDRESS_1, BRAND_ADDRESS_2, BRAND_OFFICES.

These exist so a legal entity, address or support address change is a config change rather than a code change. Views read them through the brand() helper; no template hardcodes a company name.


6. Agents and uploads

| Variable | Purpose | Current | | --- | --- | --- | | AGENT_HEARTBEAT_STALE | Seconds before a heartbeat is stale | set | | AGENT_HEARTBEAT_OFFLINE | Seconds before a device is offline | set | | ENROLLMENT_TTL | Lifetime of a single-use enrolment token | set | | MAX_UPLOAD_BYTES | Largest accepted upload | 26214400 (25 MiB) |

Availability is derived from heartbeat recency against these thresholds. A device is not "online" because a column says so; it is online because it reported recently. open_basedir is /var/www/vhosts/arxd.org/:/tmp/, so an upload path outside that tree fails with a permission error that reads like a missing file.


7. Payments

| Variable | Purpose | Current | | --- | --- | --- | | PAYPAL_ENABLED | Use PayPal | true | | PAYPAL_CLIENT_ID | OAuth client | set | | PAYPAL_CLIENT_SECRET | OAuth secret | set | | PAYPAL_WEBHOOK_ID | Webhook to verify signatures against | set | | PAYPAL_SANDBOX | Sandbox endpoint | true | | PAYPAL_TIMEOUT | HTTP timeout, seconds | set | | STRIPE_ENABLED | Use Stripe | false | | STRIPE_SECRET_KEY | Stripe secret | unset | | STRIPE_PUBLISHABLE_KEY | Stripe publishable key | unset | | STRIPE_WEBHOOK_SECRET | Stripe signing secret | unset |

PAYPAL_SANDBOX=true in production is deliberate and was not changed by this work. While it holds, no real money moves. Before taking real payments the owner must flip it and run paypal:check against the live endpoint — and note that paypal:check verifies credentials and the webhook subscription, not the full payment path.


8. AI

| Variable | Purpose | Current | | --- | --- | --- | | LYRA_ENABLED | Enable the assistant | true | | LYRA_API_KEY | Provider key | set | | LYRA_MODEL | Model identifier | set | | LYRA_DAILY_REQUESTS | Per-tenant daily cap | set | | LYRA_BUDGET_SECONDS | Wall-clock budget per run | set | | LYRA_MAX_TOOL_ROUNDS | Tool round cap | set | | LYRA_MAX_TOKENS | Completion ceiling | set |

Cost control is LYRA_DAILY_REQUESTS, LYRA_MAX_TOKENS and the round cap together. The token ceiling alone does not bound spend, because a run can make many small calls. ai:check reports which providers exist and which answer right now; lyra:status reports today's usage and the last error.


9. Voice

| Variable | Purpose | Current | | --- | --- | --- | | SIGNALWIRE_ENABLED | Telephony | false | | SIGNALWIRE_MODE | Operation mode | set | | SIGNALWIRE_SPACE, _PROJECT_ID, _API_TOKEN, _SIGNING_KEY, _PHONE_NUMBER, _SIP_DOMAIN, _TIMEOUT | Credentials and routing | set | | CARTESIA_ENABLED | Speech synthesis | true | | CARTESIA_API_KEY, _VERSION, _MODEL_ID, _VOICE_ID, _CONTAINER, _ENCODING, _SAMPLE_RATE | Synthesis configuration | set |

SIGNALWIRE_ENABLED=false means inbound and outbound telephony is off. The endpoints report that state instead of accepting a call and dropping it. The voice stack is documented in docs/voice.md.


10. Conversion tracking and mail

| Variable | Purpose | Current | | --- | --- | --- | | CONVERSIONS_ENABLED | Report conversions | true | | GA4_MEASUREMENT_ID, GA4_API_SECRET | Google Analytics 4 | set | | META_PIXEL_ID, META_ACCESS_TOKEN | Meta | set | | GOOGLE_ADS_CUSTOMER_ID, _CONVERSION_ACTION, _DEVELOPER_TOKEN, _CLIENT_ID, _CLIENT_SECRET, _REFRESH_TOKEN, _LOGIN_CUSTOMER_ID | Google Ads offline conversions | set | | CONVERSION_WEBHOOK_URL | Generic sink | set | | MAIL_BOUNCE_ADDRESS, MAIL_BOUNCE_MAILDIR | Bounce processing | set | | ARXD_WATCHDOG_NTFY_TOPIC, ARXD_WATCHDOG_WEBHOOK | Worker alerting | set |

conversions:test --dry-run verifies the credentials actually work, once. It is the only way to know whether a conversion will be recorded or silently dropped — a 200 from an advertising API does not mean it accepted the payload.


11. Not configured — and therefore not pretending to work

No GITHUB_* variable is set in .env. The Developer Hub is now fully implemented against them — OAuth connect, encrypted token storage, repository and branch pickers, and a queued import/build — but with both halves blank, GitHubClient::configured() is false and /portal/developer renders a notice that names GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET instead of a Connect button. Verified by rendering the page and searching it for those two names. Nothing claims to be connected, and no build can be queued.

| Variable | Meaning | State here | | --- | --- | --- | | GITHUB_CLIENT_ID | OAuth application client id | unset | | GITHUB_CLIENT_SECRET | OAuth application client secret | unset | | GITHUB_TIMEOUT | Total seconds for a GitHub API call | 20 (default) |

The callback URL to register on the OAuth application is https://arxd.org/portal/developer/callback. It is built from APP_URL, not from the request Host, so a forged header cannot move an authorisation code elsewhere — and it must match what GitHub holds exactly, or the round trip fails.

The same rule applies to STRIPE_*: disabled, and every surface that would use it reports the disabled state.

The rule this document exists to protect: a missing credential must produce a precise, visible "not configured" state. It must never produce a green check, a plausible number, or a success message. A fake healthy integration stops anyone from fixing the real one.


12. Adding a variable

  1. Add it to .env with 600 permissions and to this document in the same

commit. A variable that exists in one and not the other is drift.

  1. Read it through arxd_env(), never getenv(), so the coercion is consistent.
  2. Give it a sensible default in code, and make the absence of a credential a

visible state rather than a silent fallback.

  1. Never commit .env. Never echo a secret into a log line, an exception message

or an audit row.

Rendered from docs/ in the repository and escaped before display. The directory itself is not served.