#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")" mkdir -p data/db data/files export APP_HOST="${APP_HOST:-0.0.0.0}" export APP_PORT="${APP_PORT:-3000}" export DATABASE_URL="${DATABASE_URL:-sqlite://$(pwd)/data/db/rustpad.db?mode=rwc}" export FILES_DIR="${FILES_DIR:-$(pwd)/data/files}" export UPLOAD_MAX_SIZE_MB="${UPLOAD_MAX_SIZE_MB:-20}" export STATIC_DIR="${STATIC_DIR:-$(pwd)/static}" export RUST_LOG="${RUST_LOG:-rustpad=debug,tower_http=info}" # Generate a new asset version on each run to prevent stale HTML and JavaScript. export ASSET_VERSION="${ASSET_VERSION:-dev-$(date +%s)}" if command -v cargo >/dev/null 2>&1; then echo "Cleaning RustPad build artifacts..." cargo clean --package rustpad echo "Starting RustPad..." exec cargo run --package rustpad fi if command -v docker >/dev/null 2>&1; then export IMAGE_TAG="${IMAGE_TAG:-dev}" echo "Starting RustPad with Docker..." exec docker compose up --build --force-recreate --remove-orphans fi echo "Neither Cargo nor Docker was found. Install Rust 1.85+ or Docker." >&2 exit 1