A community based topic aggregation platform built on atproto
1#!/bin/bash
2set -e
3
4echo "Starting Kagi News RSS Aggregator..."
5echo "========================================="
6
7# Load environment variables if .env file exists
8if [ -f /app/.env ]; then
9 echo "Loading environment variables from .env"
10 export $(grep -v '^#' /app/.env | xargs)
11fi
12
13# Validate required environment variables
14if [ -z "$AGGREGATOR_HANDLE" ] || [ -z "$AGGREGATOR_PASSWORD" ]; then
15 echo "ERROR: Missing required environment variables!"
16 echo "Please set AGGREGATOR_HANDLE and AGGREGATOR_PASSWORD"
17 exit 1
18fi
19
20echo "Aggregator Handle: $AGGREGATOR_HANDLE"
21echo "Cron schedule loaded from /etc/cron.d/kagi-aggregator"
22
23# Start cron in the background
24echo "Starting cron daemon..."
25cron
26
27# Optional: Run aggregator immediately on startup (for testing)
28if [ "$RUN_ON_STARTUP" = "true" ]; then
29 echo "Running aggregator immediately (RUN_ON_STARTUP=true)..."
30 cd /app && python -m src.main
31fi
32
33echo "========================================="
34echo "Kagi News Aggregator is running!"
35echo "Cron schedule: Daily at 1 PM UTC"
36echo "Logs will appear below:"
37echo "========================================="
38echo ""
39
40# Execute the command passed to docker run (defaults to tail -f /var/log/cron.log)
41exec "$@"