#!/bin/bash

# Configuration
MINIO_ALIAS="minio"
BUCKET_NAME="systeme-retro-testing"
FILE_PATH="$1"

# Check if the file exists
if [ ! -f "$FILE_PATH" ]; then
    echo "Error: File $FILE_PATH not found."
    exit 1
fi

# Create the bucket if it doesn't exist
mc alias set $MINIO_ALIAS http://localhost:9000
mc mb "$MINIO_ALIAS/$BUCKET_NAME" || true

# Upload the file to the bucket
mc cp "$FILE_PATH" "$MINIO_ALIAS/$BUCKET_NAME/"

# Optional: Verify the upload
echo "Upload completed."
mc ls "$MINIO_ALIAS/$BUCKET_NAME"
