#!/usr/bin/env bash set -euo pipefail echo "→ Checking for Nextcloud service..." # Check if nextcloud service exists if ! docker compose ps | grep -q nextcloud; then echo " Nextcloud service not found in compose setup" echo " Skipping Nextcloud configuration (external setup required)" exit 0 fi echo "→ Configuring Nextcloud via occ..." NC="docker compose exec -T nextcloud php occ" # Enable recommended apps $NC app:enable notify_push 2>/dev/null || echo " notify_push not available, skipping" $NC app:enable files_accesscontrol 2>/dev/null || echo " files_accesscontrol not available, skipping" # Create service account for rehearsalhub $NC user:add \ --display-name "RehearsalHub Service" \ --password-from-env \ rh_service \ <<< "${NEXTCLOUD_ADMIN_PASSWORD:-change_me}" || echo " Service account may already exist" # Set permissions $NC user:setting rh_service core lang en $NC config:system:set trusted_domains 1 --value="${DOMAIN:-localhost}" $NC config:system:set trusted_domains 2 --value="nc.${DOMAIN:-localhost}" # Create base folder structure $NC files:scan --all echo "✓ Nextcloud setup complete"