mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
fix(config): Replace '__' to '_' globally when decoding hostRules from env (#10939)
This commit is contained in:
parent
7842ff721b
commit
31785b8742
2 changed files with 16 additions and 1 deletions
|
@ -114,6 +114,21 @@ describe(getName(), () => {
|
||||||
expect(res).toMatchSnapshot();
|
expect(res).toMatchSnapshot();
|
||||||
expect(res.hostRules).toHaveLength(2);
|
expect(res.hostRules).toHaveLength(2);
|
||||||
});
|
});
|
||||||
|
it('regression test for #10937', () => {
|
||||||
|
const envParam: NodeJS.ProcessEnv = {
|
||||||
|
GIT__TAGS_GITLAB_EXAMPLE__DOMAIN_NET_USERNAME: 'some-user',
|
||||||
|
GIT__TAGS_GITLAB_EXAMPLE__DOMAIN_NET_PASSWORD: 'some-password',
|
||||||
|
};
|
||||||
|
const res = env.getConfig(envParam);
|
||||||
|
expect(res.hostRules).toMatchObject([
|
||||||
|
{
|
||||||
|
hostType: 'git-tags',
|
||||||
|
matchHost: 'gitlab.example-domain.net',
|
||||||
|
password: 'some-password',
|
||||||
|
username: 'some-user',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
it('supports datasource env token', () => {
|
it('supports datasource env token', () => {
|
||||||
const envParam: NodeJS.ProcessEnv = {
|
const envParam: NodeJS.ProcessEnv = {
|
||||||
PYPI_TOKEN: 'some-token',
|
PYPI_TOKEN: 'some-token',
|
||||||
|
|
|
@ -100,7 +100,7 @@ export function getConfig(env: NodeJS.ProcessEnv): AllConfig {
|
||||||
continue; // eslint-disable-line no-continue
|
continue; // eslint-disable-line no-continue
|
||||||
}
|
}
|
||||||
// Double underscore __ is used in place of hyphen -
|
// Double underscore __ is used in place of hyphen -
|
||||||
const splitEnv = envName.toLowerCase().replace('__', '-').split('_');
|
const splitEnv = envName.toLowerCase().replace(/__/g, '-').split('_');
|
||||||
const hostType = splitEnv.shift();
|
const hostType = splitEnv.shift();
|
||||||
if (datasources.has(hostType)) {
|
if (datasources.has(hostType)) {
|
||||||
const suffix = splitEnv.pop();
|
const suffix = splitEnv.pop();
|
||||||
|
|
Loading…
Reference in a new issue