Files

22 lines
817 B
Bash
Raw Permalink Normal View History

2026-09-13 20:12:28 +01:00
#!/bin/sh
# Container entrypoint for Martinhal DataHub.
# 1) make sure the persistent directories exist,
# 2) run the idempotent database initializer (creates schema + first admin),
# 3) hand off to the main process (node server.js).
set -e
# Resolve storage locations (fall back to the image defaults).
DB_FILE="${DB_PATH:-/app/data/datahub.db}"
DB_DIR="$(dirname "$DB_FILE")"
mkdir -p "$DB_DIR" "${UPLOAD_DIR:-/app/uploads}" "${BRAND_DIR:-/app/brand}" "${AVATAR_DIR:-/app/avatars}"
# init-db.js is safe to run on every start: it creates any missing tables and
# seeds the default email templates. It does NOT create the administrator —
# on first boot the site shows a setup wizard in the browser for that.
echo "[entrypoint] preparing database ..."
node init-db.js
echo "[entrypoint] starting: $*"
exec "$@"