yt-dlp-dags/airflow/init-yt-service.sh
2025-08-26 18:00:55 +03:00

33 lines
1.1 KiB
Bash

#!/bin/bash
#
# This script should be run on the YT Service host to initialize the environment.
# It creates the .env file from the example if it doesn't exist.
#
set -e
# --- Configuration ---
# The directory where docker-compose-ytdlp-ops.yaml is located
SERVICE_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$SERVICE_DIR"
echo "--- Initializing YT Service Environment in $SERVICE_DIR ---"
# --- Step 1: Create .env file from .env.example ---
if [ -f ".env" ]; then
echo ".env file already exists. Skipping creation."
else
if [ -f ".env.example" ]; then
echo "Creating .env file from .env.example..."
cp .env.example .env
echo ".env file created. IMPORTANT: Please edit it with your production values."
else
echo "Warning: .env.example not found. Cannot create .env file."
echo "Please create a .env file manually."
fi
fi
echo "----------------------------------------"
echo "Initialization check complete."
echo "Please review the .env file and then follow the 'Next Steps' from the deployment script."