#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")/.." role="${1:?Usage: rotate-service-secret.sh api|worker}" [[ "$role" == api || "$role" == worker ]] || exit 2 python3 - "$role" <<'PY' import secrets,sys from pathlib import Path for name in ['redis-'+sys.argv[1],'s3-'+sys.argv[1]]: p=Path('secrets/operator')/name p.write_text(secrets.token_hex(24));p.chmod(0o600) PY scripts/bootstrap-openbao.sh scripts/dc.sh restart cache if [[ "$role" == api ]]; then scripts/dc.sh restart api api2; else scripts/dc.sh restart worker; fi