/** * What the forge told this process, read once and named once. Every other * module takes these from here, so nothing else spells an environment * variable — and running the app by hand needs none of them. */ import pkg from "../package.json"; export const title: string = pkg.name; /** The app's own version (package.json): what `/healthz` and `/openapi.json` say. */ export const version: string = pkg.version ?? "0.0.0"; /** When this process started, for `/healthz`'s uptime. */ export const startedAt: number = Date.now(); export const description: string = pkg.description || "A new app on the forge."; export const dataDir: string = process.env.FORGE_APP_DATA ?? "./data"; export const env: string = process.env.FORGE_APP_ENV ?? "local"; export const commit: string = (process.env.FORGE_APP_COMMIT ?? "").slice(0, 7); /** Where this process runs, for a person: `production`, `preview of pull #3`, `local`. */ export const where: string = env === "preview" ? `preview of pull #${process.env.FORGE_APP_PULL ?? "?"}` : env; /** The exact command that opens this environment's terminal. Print it verbatim, never a guess. */ export const ssh: string | undefined = process.env.FORGE_APP_SSH; /** The address the forge serves us at — what a browser sees, never the socket's. */ export const publicOrigin: string = new URL( process.env.FORGE_APP_URL ?? "http://localhost", ).origin; /** The forge that runs us. Its own well-known files (security.txt) speak for its apps. */ export const forgeUrl: string | undefined = process.env.FORGE_URL; /** The key the forge signs identities with (`who.ts`). Unset, everyone is anonymous. */ export const identityKey: string = process.env.FORGE_APP_IDENTITY_KEY ?? "";