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 });