Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/nperez0111/bookhive. Track your books, share your shelves, see what others are reading bookhive.buzz
atproto bluesky books bookshelf goodreads management-system
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import { cleanEnv, port, str, testOnly } from "envalid";
// Bun loads .env automatically; envalid reads process.env
export const env = cleanEnv(process.env, { NODE_ENV: str({ default: "production", devDefault: testOnly("test"), choices: ["development", "production", "test"], }), PORT: port({ default: 8080 }), PUBLIC_URL: str({ default: "http://127.0.0.1:8080", devDefault: `http://127.0.0.1:${process.env["PORT"] ?? 8080}`, desc: "Public origin for OAuth callbacks (RFC 8252 requires loopback IP not localhost). In dev, auto-derives from PORT when not explicitly set.", }), DB_PATH: str({ devDefault: ":memory:", desc: "Path to the SQLite database" }), KV_DB_PATH: str({ devDefault: ":memory:", desc: "Path to the KV SQLite database", }), EXPORT_SHARED_SECRET: str({ default: "", desc: "Shared secret for triggering DB exports via /admin/export (Bearer token). Leave empty to disable.", }), DB_EXPORT_DIR: str({ default: "", desc: "Directory to write temporary export artifacts. Defaults to the directory containing DB_PATH.", }), LOG_LEVEL: str({ default: "info", desc: "Log level for the app" }), COOKIE_SECRET: str({ devDefault: "00000000000000000000000000000000" }), OPEN_OBSERVE_URL: str({ devDefault: "" }), OPEN_OBSERVE_USER: str({ devDefault: "" }), OPEN_OBSERVE_PASSWORD: str({ devDefault: "" }), PDS_URL: str({ default: "", desc: "Internal URL to reach the PDS (e.g. http://pds:3000). Empty disables signup.", }), PDS_ADMIN_PASSWORD: str({ default: "", desc: "Admin password for the PDS, used to mint invite codes.", }), /** Optional: set in CI/deploy for observability (e.g. git rev-parse HEAD) */ BUILD_SHA: str({ default: "", desc: "Commit or build identifier" }), BOOKHIVE_SERVICE_HANDLE: str({ default: "", desc: "Handle for @bookhive.buzz service account (app password auth)", }), BOOKHIVE_APP_PASSWORD: str({ default: "", desc: "App password for @bookhive.buzz service account", }), PRIVATE_KEY_JWK: str({ default: "", desc: "ES256 private JWK for confidential OAuth client (generate with `bun run scripts/generate-jwk.ts`). When empty, falls back to public client.", }),});