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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657import { 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.", }), DATABASE_URL: str({ devDefault: "postgres://bookhive:bookhive@localhost:5432/bookhive", desc: "PostgreSQL connection URL", }), 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.", }), 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.", }),});