summarylogtreecommitdiffstats
path: root/silverbullet.sh
diff options
context:
space:
mode:
authorKirill Isakov2025-03-06 19:55:40 +0500
committerKirill Isakov2025-03-06 19:55:40 +0500
commite992e00f4642ccd7e98995d0987c90f7d6c4b452 (patch)
tree6e335fed54a31ee736d0db98ee39fa95438b93cf /silverbullet.sh
parent974ab98203a250c4ce1afc47547ea9afd03a8780 (diff)
downloadaur-silverbullet.tar.gz
silverbullet: support for per-user service
Diffstat (limited to 'silverbullet.sh')
-rw-r--r--silverbullet.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/silverbullet.sh b/silverbullet.sh
new file mode 100644
index 000000000000..89c707cf95d8
--- /dev/null
+++ b/silverbullet.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/sh
+
+set -eu
+
+HOST=${HOST:-localhost}
+PORT=${PORT:-3000}
+echo >&2 "listening on $HOST:$PORT"
+
+if [ $# -gt 1 ]; then
+ echo >&2 "usage: $0 optional_path"
+ exit 1
+fi
+
+if [ $# = 1 ]; then
+ echo >&2 "overriding $DOCS with $1"
+ DOCS=$1
+fi
+
+if [ -z "${DOCS:-}" ]; then
+ echo >&2 'root directory not set in $DOCS'
+ exit 1
+fi
+
+echo >&2 "using root directory $DOCS"
+mkdir -p "$DOCS"
+
+exec /usr/bin/deno run \
+ --allow-all \
+ --unstable-kv \
+ --unstable-worker-options \
+ /usr/lib/silverbullet/silverbullet.js \
+ --hostname "$HOST" \
+ --port "$PORT" \
+ "$DOCS"