From 0db59064169358b9512ebe369f3a0437ee66e544 Mon Sep 17 00:00:00 2001 From: tada5hi Date: Sun, 20 Mar 2022 11:36:46 +0100 Subject: [PATCH] allow hostnames + urls for host env --- src/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0bfff88..30f50a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -48,10 +48,18 @@ const registries : RegistryConfig[] = []; const sum = envAggregation[RegistryEnv.HOST].length; for (let i = 0; i < sum; i++) { - const url = new URL(envAggregation[RegistryEnv.HOST][i]); + let host : string = envAggregation[RegistryEnv.HOST][i]; + + if ( + host.startsWith('http://') || + host.startsWith('https://') + ) { + const parsed = new URL(host); + host = parsed.hostname; + } registries.push({ - host: url.hostname, + host, username: envAggregation[RegistryEnv.USERNAME][i], password: envAggregation[RegistryEnv.PASSWORD][i], });