mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-02 18:43:40 +00:00
2832648dda
In 01bcd4fd43 we introduced knowledge of
the Maven Central mirror, but haven't taken it into account when looking
at rate limit errors.
To prevent this in the future, we can introduce a new helper function,
`isMavenCentral`, for other usage.
17 lines
521 B
TypeScript
17 lines
521 B
TypeScript
import { parseUrl } from '../../../util/url.ts';
|
|
export const id = 'maven';
|
|
|
|
export const MAVEN_REPO = 'https://repo.maven.apache.org/maven2';
|
|
export const MAVEN_CENTRAL_MIRROR = 'https://repo1.maven.org/maven2';
|
|
export const MAVEN_CENTRAL_URLS = [MAVEN_REPO, MAVEN_CENTRAL_MIRROR];
|
|
|
|
function getHost(url: string): string | undefined {
|
|
return parseUrl(url)?.host;
|
|
}
|
|
|
|
export function isMavenCentral(url: string): boolean {
|
|
return MAVEN_CENTRAL_URLS.some(
|
|
(mavenRepo) => getHost(url) === getHost(mavenRepo),
|
|
);
|
|
}
|