pike/glyph Public Public: anyone can read this; nobody can change it.

forked from apps/glyph

workbenchthis machine
Files 5c2d82ded0cf18c81c70d9f4a3f1de0b1688b125
32 lines · 1.7 KB · ~495 tok Raw History
1
/**
2
 * What the forge told this process, read once and named once. Every other
3
 * module takes these from here, so nothing else spells an environment
4
 * variable — and running the app by hand needs none of them.
5
 */
6
7
import pkg from "../package.json";
8
9
export const title: string = pkg.name;
10
/** The app's own version (package.json): what `/healthz` and `/openapi.json` say. */
11
export const version: string = pkg.version ?? "0.0.0";
12
/** When this process started, for `/healthz`'s uptime. */
13
export const startedAt: number = Date.now();
14
export const description: string = pkg.description || "A new app on the forge.";
15
export const dataDir: string = process.env.FORGE_APP_DATA ?? "./data";
16
export const env: string = process.env.FORGE_APP_ENV ?? "local";
17
export const commit: string = (process.env.FORGE_APP_COMMIT ?? "").slice(0, 7);
18
/** Where this process runs, for a person: `production`, `preview of pull #3`, `local`. */
19
export const where: string =
20
  env === "preview"
21
    ? `preview of pull #${process.env.FORGE_APP_PULL ?? "?"}`
22
    : env;
23
/** The exact command that opens this environment's terminal. Print it verbatim, never a guess. */
24
export const ssh: string | undefined = process.env.FORGE_APP_SSH;
25
/** The address the forge serves us at — what a browser sees, never the socket's. */
26
export const publicOrigin: string = new URL(
27
  process.env.FORGE_APP_URL ?? "http://localhost",
28
).origin;
29
/** The forge that runs us. Its own well-known files (security.txt) speak for its apps. */
30
export const forgeUrl: string | undefined = process.env.FORGE_URL;
31
/** The key the forge signs identities with (`who.ts`). Unset, everyone is anonymous. */
32
export const identityKey: string = process.env.FORGE_APP_IDENTITY_KEY ?? "";
↑↓ navigate ↵ open esc close
↑↓ navigate ↵ open esc close

Keyboard shortcuts