Script Parameters
Script parameters let one script be reused across repositories without hard-coding every value.
Borg UI detects Bash-style placeholders:
${PARAM}
${PARAM:-default}Parameter names must be uppercase snake case:
DB_HOST
DB_PASSWORD
API_TOKEN
BACKUP_DIRRequired vs Optional
Required:
pg_dump -h "${DB_HOST}" -U "${DB_USER}" "${DB_NAME}"Optional with default:
BACKUP_DIR="${BACKUP_DIR:-/tmp/borg-ui-dumps}"If a default exists, Borg UI treats the parameter as optional.
Secret Detection
Parameters with these suffixes are treated as password fields:
_PASSWORD_TOKEN_SECRET_KEY_API_KEY_PASSPHRASE_APIKEY_AUTH_CREDENTIAL_CREDENTIALS
Example:
curl -H "Authorization: Bearer ${API_TOKEN}" "${ENDPOINT_URL}"API_TOKEN is shown as a secret field.
Reserved Variables
Variables starting with BORG_UI_ are reserved and injected by Borg UI at runtime.
Do not define parameters with this prefix.
Injected variables include:
| Variable | Meaning |
|---|---|
BORG_UI_HOOK_TYPE | pre-backup or post-backup |
BORG_UI_BACKUP_STATUS | post-backup result |
BORG_UI_REPOSITORY_ID | repository ID |
BORG_UI_REPOSITORY_NAME | repository name |
BORG_UI_REPOSITORY_PATH | repository path |
BORG_UI_JOB_ID | backup job ID |
BORG_UI_REMOTE_HOST | remote source host for script library execution and script tests, when available |
BORG_UI_REMOTE_PORT | remote source SSH port for script library execution and script tests |
BORG_UI_REMOTE_USERNAME | remote source username for script library execution and script tests |
BORG_UI_SOURCE_HOST | remote source host for legacy inline repository hooks, when available |
BORG_UI_SOURCE_PORT | remote source SSH port for legacy inline repository hooks |
BORG_UI_SOURCE_USERNAME | remote source username for legacy inline repository hooks |
If a script must work in both paths, read REMOTE first and fall back to SOURCE:
remote_host="${BORG_UI_REMOTE_HOST:-${BORG_UI_SOURCE_HOST:-}}"
remote_port="${BORG_UI_REMOTE_PORT:-${BORG_UI_SOURCE_PORT:-22}}"
remote_user="${BORG_UI_REMOTE_USERNAME:-${BORG_UI_SOURCE_USERNAME:-}}"Example
#!/usr/bin/env bash
set -euo pipefail
dump_dir="${DUMP_DIR:-/local/db-dumps}"
mkdir -p "$dump_dir"
mysqldump \
-h "${DB_HOST}" \
-P "${DB_PORT:-3306}" \
-u "${DB_USER}" \
-p"${DB_PASSWORD}" \
"${DB_NAME}" > "$dump_dir/${DB_NAME}.sql"Detected parameters:
| Parameter | Required | Type |
|---|---|---|
DB_HOST | yes | text |
DB_PORT | no | text |
DB_USER | yes | text |
DB_PASSWORD | yes | password |
DB_NAME | yes | text |
DUMP_DIR | no | text |
Safety
Parameter values are passed as environment variables to the script process. They are not interpolated into a shell command by Borg UI.
Your script is still responsible for quoting variables correctly:
"${DB_NAME}"not:
$DB_NAME
