#!/usr/bin/env sh
# Creates S3 buckets required by local dev services.
# Called by the s3-init Docker Compose service after rustfs is healthy.

set -e

ENDPOINT="${S3_ENDPOINT:-http://s3:9000}"

BUCKETS="
  search-snapshots
  uploads
"

for bucket in $BUCKETS; do
  aws --endpoint-url "$ENDPOINT" s3 mb "s3://$bucket" 2>/dev/null || true
  echo "Ensured bucket: $bucket"
done
