mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
20 lines
519 B
TypeScript
20 lines
519 B
TypeScript
import { isHttpUrl, joinUrlParts } from '../../../util/url';
|
|
import type {
|
|
ServiceDiscoveryEndpointType,
|
|
ServiceDiscoveryResult,
|
|
} from './types';
|
|
|
|
export function createSDBackendURL(
|
|
registryURL: string,
|
|
sdType: ServiceDiscoveryEndpointType,
|
|
sdResult: ServiceDiscoveryResult,
|
|
subPath: string,
|
|
): string {
|
|
const sdEndpoint = sdResult[sdType] ?? '';
|
|
const fullPath = joinUrlParts(sdEndpoint, subPath);
|
|
if (isHttpUrl(fullPath)) {
|
|
return fullPath;
|
|
}
|
|
return joinUrlParts(registryURL, fullPath);
|
|
}
|