/// // Token check used by docwell-server: returns the "users" record that owns the // bearer token (with its organization expanded), or 401. Unlike auth-refresh, // it does not issue a new token. routerAdd( "GET", "/api/docwell/auth/verify", (e) => { e.auth.ignoreEmailVisibility(true); e.app.expandRecord(e.auth, ["organization"], null); return e.json(200, e.auth); }, $apis.requireAuth("users"), ); // Instance settings come from the environment and are applied on every start, // so changing an env var and restarting is enough. onBootstrap((e) => { e.next(); const env = (key, def) => $os.getenv(key) || def; const settings = e.app.settings(); settings.meta.appName = env("DOCWELL_APP_NAME", "Docwell"); settings.meta.appURL = env("DOCWELL_WEB_URL", "http://localhost:3000"); settings.meta.senderName = settings.meta.appName; settings.meta.senderAddress = env("DOCWELL_MAIL_FROM", "no-reply@docwell.localhost"); const smtpHost = env("DOCWELL_SMTP_HOST", ""); settings.smtp.enabled = smtpHost !== ""; if (smtpHost) { settings.smtp.host = smtpHost; settings.smtp.port = parseInt(env("DOCWELL_SMTP_PORT", "587"), 10); settings.smtp.username = env("DOCWELL_SMTP_USERNAME", ""); settings.smtp.password = env("DOCWELL_SMTP_PASSWORD", ""); settings.smtp.tls = env("DOCWELL_SMTP_TLS", "false") === "true"; } e.app.save(settings); });