mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-30 17:27:26 +00:00
b39b50f559
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>
32 lines
823 B
TypeScript
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);
|
|
}
|