diff --git a/docs/usage/self-hosting.md b/docs/usage/self-hosting.md index 6ee632fef2eac4177c95bad0283e423e85b5d3d7..d17d179c95bc148034077bc625469750dd118329 100644 --- a/docs/usage/self-hosting.md +++ b/docs/usage/self-hosting.md @@ -208,6 +208,8 @@ If you are configuring using environment variables, there are two possibilities: If you combine both of the above then any single config option in the environment variable will override what's in `RENOVATE_CONFIG`. +Note: it's also possible to change the default prefix from `RENOVATE_` using `ENV_PREFIX`. e.g. `ENV_PREFIX=RNV_ RNV_TOKEN=abc123 renovate`. + ## Authentication Regardless of platform, you need to select a user account for `renovate` to assume the identity of, and generate a Personal Access Token. diff --git a/lib/config/env.ts b/lib/config/env.ts index cb7dcf10a4713db8d2078cf0f9f2925803bc5337..c27e092eeaba1776f96d383e666ac6bdaad734c2 100644 --- a/lib/config/env.ts +++ b/lib/config/env.ts @@ -6,6 +6,15 @@ import { logger } from '../logger'; import { getOptions } from './definitions'; import type { GlobalConfig, RenovateOptions } from './types'; +// istanbul ignore if +if (process.env.ENV_PREFIX) { + for (const [key, val] of Object.entries(process.env)) { + if (key.startsWith(process.env.ENV_PREFIX)) { + process.env[key.replace(process.env.ENV_PREFIX, 'RENOVATE_')] = val; + } + } +} + export function getEnvName(option: Partial<RenovateOptions>): string { if (option.env === false) { return '';