registryOpen

tcmts.registry.registryOpen · #uyg7f2sc · term · runs on the server

uses node:crypto

Open the registry's codebase for the forge's code to read (shareNow), read-only: everyone is a reader (a token no one has, so no one is the maintainer). What reads it and shows no page (search) does this alone.

import { registryCodebase, registryDir } from "#codebase/tcmts/registry";
import { keepWarm, opened, shareCache } from "#codebase/tcmts/share";
import { randomBytes } from "node:crypto";

export function registryOpen(): void {
  const dir = registryDir();
  if (opened.has(dir)) return;
  process.env.TCM_SHARE_CODEBASE = dir;
  process.env.TCM_SHARE_PUBLIC = "1";
  process.env.TCM_SHARE_TOKEN ||= randomBytes(24).toString("hex");
  const served = { cb: registryCodebase(), cache: shareCache() };
  opened.set(dir, served);
  keepWarm(served);
}

uses

used by