registryEnv

tcmts.cli.run.registryEnv · #kprhlkrh · term · runs on the server

uses node:crypto

The environment tcm registry runs the registry's app in: its own, but not the codebase or branch this command was given, stopping with it, and the forge's pages set up from the start as a registry has them: everyone a reader, the server's token one no one has (left unset until a page ran, a call before it found no token, and took the caller for the maintainer).

import { randomBytes } from "node:crypto";

export function registryEnv(from: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
  const env: NodeJS.ProcessEnv = {
    ...from,
    TCM_STOP_WITH_PARENT: "1",
    TCM_SHARE_PUBLIC: "1",
    TCM_SHARE_TOKEN: randomBytes(24).toString("hex"),
  };
  delete env.TCM_CODEBASE;
  delete env.TCM_BRANCH;
  return env;
}

used by