Change thresholds, endpoint paths and which checks run, per environment.
The plugin works without any configuration beyond LEDGE_SECRET_KEY. Everything else has a default you can change, either with an environment variable or in config/ledge.php. There are no settings in the control panel.
Each setting is read in this order:
config/ledge.php, if you've set it.SCREAMING_SNAKE_CASE with a LEDGE_ prefix. diskUnhealthyAt reads LEDGE_DISK_UNHEALTHY_AT.Environment variables are the easiest way to vary settings between staging and production. To start a config file with every option listed and commented out, run:
./craft ledge/publish-configIt won't overwrite an existing config/ledge.php unless you pass --force.
<?php
return [
'diskDegradedAt' => 85,
'diskUnhealthyAt' => 95,
'queueStaleAfter' => 600,
'enabledChecks' => [
'failedLogins' => false,
],
];LEDGE_SECRET_KEY="…"
LEDGE_DISK_DEGRADED_AT=85
LEDGE_DISABLED_CHECKS=failedLogins,freeform…DegradedAt and …UnhealthyAt. A check trips a tier when the measured value is at or above it.null in the config file, or its environment variable to empty or off. With diskDegradedAt off, the disk check only reports Healthy or Unhealthy.healthy, degraded or unhealthy. Setting one to healthy keeps the condition in the check's data without affecting the site's status.Every check reports the thresholds it used, so Ledge can show why a site tripped.
All checks run by default. Turn one off with either:
LEDGE_DISABLED_CHECKS, a comma-separated list of check names, orenabledChecks in config/ledge.php, setting a check to false. Checks you don't list stay on.If the config file sets enabledChecks, LEDGE_DISABLED_CHECKS is ignored. Check names are listed in Health checks.
To keep a check running but stop one known result from affecting the site, ignore it in Ledge instead. Ignoring applies to one check on one site and leaves the rest of your fleet alone.
| Setting | Environment variable | Default | |
|---|---|---|---|
secretKey | LEDGE_SECRET_KEY | none | The shared key. Generate it with ./craft ledge/generate-key. |
keyHeader | LEDGE_KEY_HEADER | X-Ledge-Key | Request header that carries the key. |
allowQueryKey | LEDGE_ALLOW_QUERY_KEY | false | Also accept the key as a query parameter. Leave this off unless a proxy strips headers: keys in URLs end up in access logs. |
queryKeyParam | LEDGE_QUERY_KEY_PARAM | key | Name of that query parameter. |
endpointPath | LEDGE_ENDPOINT_PATH | _ledge/health | Path of the health endpoint. |
dependenciesEnabled | LEDGE_DEPENDENCIES_ENABLED | true | Report installed Composer packages, used to match security advisories. |
dependenciesPath | LEDGE_DEPENDENCIES_PATH | _ledge/dependencies | Path of the package list. |
If you change a path, update the health check URL in Ledge to match.
| Setting | Default | |
|---|---|---|
diskDegradedAt / diskUnhealthyAt | 80 / 90 | Percentage of the storage volume used. |
diskMinFreeBytes | off | Unhealthy when free space drops below this, whatever the percentage. |
memoryDegradedAt / memoryUnhealthyAt | 75 / 90 | Percentage of PHP's memory_limit used. |
queueStaleAfter | 300 | Seconds a waiting job can sit unreserved before it counts as stale. |
queueFailedDegradedAt / queueFailedUnhealthyAt | off / 1 | Failed queue jobs. |
queueStaleDegradedAt / queueStaleUnhealthyAt | off / 1 | Stale queue jobs. |
failedLoginsWindow | 86400 | Seconds to look back for failed logins. |
failedLoginsDegradedAt / failedLoginsUnhealthyAt | 10 / 50 | Users with failed logins in that window. |
formieDegradedAt / formieUnhealthyAt | 1 / 11 | Formie notifications that failed to send. |
freeformDegradedAt / freeformUnhealthyAt | 1 / 11 | Errors in Freeform's log. |
phpEolDegradedWithinDays / phpEolUnhealthyWithinDays | off / 90 | Days until your PHP version stops getting security fixes. |
Each setting has a matching LEDGE_* environment variable, for example LEDGE_QUEUE_STALE_AFTER.
These decide how serious a condition is. Each takes healthy, degraded or unhealthy.
| Setting | Default | Applies when |
|---|---|---|
updateAvailableStatus | healthy | Craft or a plugin has an update. |
criticalUpdateStatus | unhealthy | Craft or a plugin has a critical update. |
devModeStatus | degraded | devMode is on. |
missingEnvVarsStatus | degraded | Your config reads an environment variable that isn't set. |
licenseIssueStatus | unhealthy | Craft or a plugin licence is invalid or doesn't match. |
phpSecurityOnlyStatus | degraded | Your PHP version only gets security fixes. |
phpEolStatus | unhealthy | Your PHP version no longer gets security fixes. |
ignoredEnvVars (LEDGE_IGNORED_ENV_VARS, comma-separated) lists environment variables the environment check shouldn't report as missing.
| Setting | Environment variable | Default | |
|---|---|---|---|
acquireEnabled | LEDGE_ACQUIRE_ENABLED | false | Let Ledge take an encrypted copy of the database for update runs and backups. |
acquireEnvDenylist | LEDGE_ACQUIRE_ENV_DENYLIST | none | Environment variable names (wildcards allowed) to leave out of the copy, on top of the ones Ledge always leaves out. |
acquireMaxBundleBytes | LEDGE_ACQUIRE_MAX_BUNDLE_BYTES | 524288000 | Largest copy the plugin will send, in bytes (500 MB). |
acquireJobTtr | LEDGE_ACQUIRE_JOB_TTR | 3600 | Seconds the queue job may run. |
acquireJobPriority | LEDGE_ACQUIRE_JOB_PRIORITY | 15 | Queue priority. Only Craft's database queue uses it. |
The copy runs as a queue job, so the site needs a working queue runner. See Install for the full list of requirements.