Make encrypted storage requirement host configurable
This commit is contained in:
1 parent
657ac97ee7
commit
06aa75095c
3 files changed
+14
-9
No files matched your search
+11
-9
@@ -25,6 +25,7 @@ ZSTD_EXTRA_OPTS="-T0 -12"
|
||||
TAR_EXCLUDES=""
|
||||
BACKUP_HISTORY_FILE="/dockervolumes/openclaw/backup-status-mcp/history/backup-runs.jsonl"
|
||||
BACKUP_HISTORY_DAYS=30
|
||||
BACKUP_REQUIRE_ENCRYPTED_STORAGE=0
|
||||
# Optional MQTT reporting and command-listener defaults.
|
||||
MQTT_REPORT_ENABLED=0
|
||||
MQTT_HOST=""
|
||||
@@ -71,8 +72,16 @@ return 0
|
||||
}
|
||||
die() { log ERROR "$1"; exit "${2:-1}"; }
|
||||
|
||||
# Never let local backups silently fall back to the unencrypted root filesystem.
|
||||
if [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
|
||||
is_true() {
|
||||
case "${1,,}" in
|
||||
1|true|yes|on|enabled) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Never let local backups silently fall back to the unencrypted root filesystem
|
||||
# on hosts that opt in (for example, Beaver's encrypted backup drive).
|
||||
if is_true "${BACKUP_REQUIRE_ENCRYPTED_STORAGE:-0}" && [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
|
||||
if ! mountpoint -q /srv/storage || ! mountpoint -q "$BACKUP_ROOT"; then
|
||||
die "Backup root is not mounted on encrypted storage; refusing to run."
|
||||
fi
|
||||
@@ -83,13 +92,6 @@ if [[ "$BACKUP_ROOT" == "/dockerbackups" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
is_true() {
|
||||
case "${1,,}" in
|
||||
1|true|yes|on|enabled) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
require_command() {
|
||||
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1" 3
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user