-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·28 lines (22 loc) · 825 Bytes
/
Copy pathstart.sh
File metadata and controls
executable file
·28 lines (22 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
set -e
APP_HOME="/app"
DATA_DIR="${DATA_DIR:-${APP_HOME}/data}"
SEED_DB="${APP_HOME}/seed/database.sqlite"
TARGET_DB="${DATA_DIR}/database.sqlite"
APP_DB="${APP_HOME}/database.sqlite"
# Provide a sane default for local training while allowing overrides
if [ -z "${COOKIE_SECRET:-}" ]; then
export COOKIE_SECRET="p9Y!2m@lK8z$1WqA7&dE4Xu0Cj"
echo "[startup] COOKIE_SECRET not provided; using bundled training value."
fi
mkdir -p "${DATA_DIR}"
if [ ! -f "${TARGET_DB}" ]; then
echo "[startup] Seeding database from pristine snapshot."
cp "${SEED_DB}" "${TARGET_DB}"
else
echo "[startup] Using existing database from ${TARGET_DB}."
fi
# Link the application database path to the persisted copy
ln -sf "${TARGET_DB}" "${APP_DB}"
exec npm run start -- --hostname "${HOST:-0.0.0.0}" --port "${PORT:-3000}"