CoolFace
Apppublic

huggingface/open-source-agent-contributions

sourceHugging Faceupdated 5mo agoView on Hugging Face
12likes
entrypoint.sh47 linesDownload Raw Back to root
1#!/bin/bash2set -e3 4echo "๐Ÿš€ Starting Hugging Face Space..."5 6# Ensure proper permissions for the app directory at runtime7chmod -R 755 /app/src/content/assets 2>/dev/null || true8 9# Check if Notion import is enabled and token is available10if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ] && [ -n "$NOTION_TOKEN" ] && [ -n "$NOTION_PAGE_ID" ]; then11    echo "๐Ÿ”„ Notion import enabled - fetching content from Notion..."12    echo "   Page ID: $NOTION_PAGE_ID"13    14    cd /app15    16    if npm run notion:import 2>&1; then17        echo "โœ… Notion import completed successfully!"18        19        echo "๐Ÿ”จ Rebuilding site with Notion content..."20        npm run build 2>&121        22        # PDF export only if Playwright was installed at build time23        if [ "${ENABLE_PDF_EXPORT:-false}" = "true" ] && command -v chromium > /dev/null 2>&1; then24            echo "๐Ÿ“„ Generating PDF..."25            npm run export:pdf -- --theme=light --wait=full 2>&1 || echo "โš ๏ธ  PDF generation failed (non-critical)"26        else27            echo "โญ๏ธ  Skipping PDF generation (Playwright not available)"28        fi29        30        echo "โœ… Site rebuilt and ready!"31    else32        echo "โš ๏ธ  Notion import failed - using pre-built content"33    fi34else35    if [ "${ENABLE_NOTION_IMPORT:-false}" = "true" ]; then36        echo "โš ๏ธ  Notion import enabled but NOTION_TOKEN or NOTION_PAGE_ID not found"37        echo "   NOTION_TOKEN: ${NOTION_TOKEN:+SET}${NOTION_TOKEN:-NOT SET}"38        echo "   NOTION_PAGE_ID: ${NOTION_PAGE_ID:+SET}${NOTION_PAGE_ID:-NOT SET}"39        echo "   โ†’ Using pre-built content"40    else41        echo "โญ๏ธ  Notion import disabled - serving pre-built content"42    fi43fi44 45echo "๐ŸŒ Starting nginx on port 8080..."46exec nginx -g 'daemon off;'47