Files
ShellBook/apps/server/src/main.ts
T
Florian Schmidt b7051d2479 Merge branch 't3/implement-auth-deploy'
Integrate auth, config, watcher and terminal wiring in buildApp: auth guards every API route by default, notebook watcher events feed the /api/events hub, the terminal runs in the configured workspace, and SHELLBOOK_DATA_DIR is the single data directory variable. The systemd unit uses KillMode=process so tmux sessions survive service restarts.
2026-11-16 00:11:06 +01:00

24 lines
784 B
TypeScript

import { buildApp } from "./app";
import { loadConfig } from "./config";
const host = process.env.SHELLBOOK_HOST ?? "127.0.0.1";
const port = Number(process.env.SHELLBOOK_PORT ?? 8080);
const proxies = process.env.SHELLBOOK_TRUSTED_PROXIES?.split(",").map(ip => ip.trim()).filter(Boolean) ?? [];
const config = loadConfig();
const app = await buildApp({
logger: true,
config,
trustProxy: proxies,
staticDir: process.env.SHELLBOOK_STATIC_DIR,
watchNotebooks: true,
auth: {
sessionMaxAgeSeconds: Number(process.env.SHELLBOOK_SESSION_SECONDS ?? 2592000),
forwardAuth: process.env.SHELLBOOK_FORWARD_AUTH_HEADER ? {
header: process.env.SHELLBOOK_FORWARD_AUTH_HEADER,
trustedProxyIps: proxies,
} : undefined,
},
});
await app.listen({ host, port });