Skip to content

Commit

Permalink
fix(host-rules): set type-less host rule for platform (#11615)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Sep 7, 2021
1 parent a07db26 commit 08ecf25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/platform/index.spec.ts
Expand Up @@ -60,6 +60,11 @@ describe('platform/index', () => {
endpoint: 'https://api.bitbucket.org/',
gitAuthor: 'user@domain.com',
hostRules: [
{
matchHost: 'api.bitbucket.org',
password: '123',
username: 'abc',
},
{
hostType: 'bitbucket',
matchHost: 'api.bitbucket.org',
Expand Down
7 changes: 6 additions & 1 deletion lib/platform/index.ts
Expand Up @@ -56,7 +56,6 @@ export async function initPlatform(config: AllConfig): Promise<AllConfig> {
// This is done for validation and will be overridden later once repo config is incorporated
setGitAuthor(returnConfig.gitAuthor);
const platformRule: HostRule = {
hostType: returnConfig.platform,
matchHost: URL.parse(returnConfig.endpoint).hostname,
};
['token', 'username', 'password'].forEach((field) => {
Expand All @@ -68,5 +67,11 @@ export async function initPlatform(config: AllConfig): Promise<AllConfig> {
returnConfig.hostRules = returnConfig.hostRules || [];
returnConfig.hostRules.push(platformRule);
hostRules.add(platformRule);
const typedPlatformRule = {
...platformRule,
hostType: returnConfig.platform,
};
returnConfig.hostRules.push(typedPlatformRule);
hostRules.add(typedPlatformRule);
return returnConfig;
}

0 comments on commit 08ecf25

Please sign in to comment.