Files
renovate/lib/config/options/env-options.ts
Jamie Tanna b39b50f559 chore: expose known environment variables (#42201)
To provide more programmatic means to determine what environment
variables configure Renovate configuration options - and whether they're
Repo, Inherit or Global config options - we can expose these in two
forms:

- `getEnvOptionsMap()`
- a static JSON file, `renovate-env-options.ts`

This will provide programmatic use-cases from a plain JSON file that can
be used more readily - especially as it's distributed in the docs and
built package - as well as a function that can be used by users of
Renovate-as-a-library.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-04-14 15:27:50 +00:00

32 lines
823 B
TypeScript

import { getEnvName } from './env.ts';
import { getOptions } from './index.ts';
export interface EnvOptionInfo {
configName: string;
globalOnly: boolean;
inheritConfigSupport: boolean;
type: string;
}
export type EnvOptionsMap = Record<string, EnvOptionInfo>;
export function getEnvOptionsMap(): EnvOptionsMap {
const entries: [string, EnvOptionInfo][] = [];
for (const option of getOptions()) {
const envName = getEnvName(option);
if (envName) {
entries.push([
envName,
{
configName: option.name,
globalOnly: option.globalOnly ?? false,
inheritConfigSupport: option.inheritConfigSupport ?? false,
type: option.type,
},
]);
}
}
entries.sort(([a], [b]) => a.localeCompare(b));
return Object.fromEntries(entries);
}