0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/modules/datasource/terraform-module/utils.ts
2024-04-17 15:57:33 +00:00

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);
}