cleanup code
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
mkdir -p data/db data/files
|
||||
@@ -11,15 +12,24 @@ 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}"
|
||||
# A new value on every run prevents stale HTML/JS cache issues.
|
||||
|
||||
# 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
|
||||
exec cargo run
|
||||
elif command -v docker >/dev/null 2>&1; then
|
||||
export IMAGE_TAG="${IMAGE_TAG:-dev}"
|
||||
exec docker compose up --build --force-recreate --remove-orphans
|
||||
else
|
||||
echo "Brak cargo i docker. Zainstaluj Rust 1.85+ albo Docker." >&2
|
||||
exit 1
|
||||
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
|
||||
Reference in New Issue
Block a user