#!/bin/bash
source "$ROOT_PATH"/scripts/common.sh
set -eo pipefail

# Function to handle errors
handle_error() {
    echo_red_bg "Error: $1"
    exit 1
}

# Define the names of the zip file and the file to add
zip_file="lambda.zip"
file_to_add=".env"

# Check if the zip file exists
if [ ! -f "$zip_file" ]; then
    handle_error "Zip file $zip_file does not exist. Exiting."
else
    # Check if the .env file exists
    if [ ! -f "$file_to_add" ]; then
        handle_error "File $file_to_add does not exist. Exiting."
    fi

    # Add the .env file to the zip file
    echo_red "Adding $file_to_add to $zip_file."
    zip -ur "$zip_file" "$file_to_add" || handle_error "Failed to add .env file to zip package"
fi
