- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/client/src/env-names.ts?format=json
18 linesreview 100%Last change review in version 27, 1 version changed it
1// Environment names: ABSO_<NAME>, or the older AVCS_<NAME> from before the rename.
2// Read the new one first; where abso sets one for a program it runs, it sets both.
4export type EnvMap = Readonly<Record<string, string | undefined>>;
6/** ABSO_<name> if set (and not empty), else AVCS_<name>. */
7export function fromEnv(env: EnvMap, name: string): string | undefined {
8 return env[`ABSO_${name}`] || env[`AVCS_${name}`] || undefined;
9}
11/** Each ABSO_ entry once more under its AVCS_ name, for programs written before the rename. */
12export function withOldNames<T extends Record<string, string | undefined>>(
13 vars: T,
14): Record<string, string | undefined> {
15 const out: Record<string, string | undefined> = { ...vars };
16 for (const [k, v] of Object.entries(vars)) if (k.startsWith("ABSO_")) out[`AVCS_${k.slice(5)}`] = v;
17 return out;
18}