25 lines
714 B
Bash
Executable File
25 lines
714 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start the server. Usage: script/server [port]
|
|
# The port defaults to $PORT, then 3000. Settings in .env (see .env-template) are loaded first.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Load local settings (Gitea OAuth, admin users, ...) from .env; see .env-template.
|
|
if [[ -f .env ]]; then
|
|
set -a
|
|
source .env
|
|
set +a
|
|
fi
|
|
|
|
port=${1:-${PORT:-3000}}
|
|
if [[ ! $port =~ ^[0-9]+$ ]] || (( port < 1 || port > 65535 )); then
|
|
echo "usage: script/server [port] (port must be 1-65535, got '$port')" >&2
|
|
exit 2
|
|
fi
|
|
|
|
if [[ ! -f resources/public/js/main.js ]]; then
|
|
echo "note: the UI isn't built, so / will show a placeholder. Run script/ui-build first." >&2
|
|
fi
|
|
|
|
PORT=$port exec clojure -X:run
|