From 7c9cd030769406bfa00b723c7c89ff5a6fd55daa Mon Sep 17 00:00:00 2001 From: fc1943s Date: Wed, 18 Aug 2021 14:27:15 -0300 Subject: [PATCH] read env vars independently --- src/Paket.Core/Versioning/PackageSources.fs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Paket.Core/Versioning/PackageSources.fs b/src/Paket.Core/Versioning/PackageSources.fs index f11bf9dae1..c32f11de41 100644 --- a/src/Paket.Core/Versioning/PackageSources.fs +++ b/src/Paket.Core/Versioning/PackageSources.fs @@ -90,12 +90,15 @@ let internal parseAuth(text:string, source) = else NetUtils.AuthType.Basic let auth = - match EnvironmentVariable.Create(username), - EnvironmentVariable.Create(password) with - | Some userNameVar, Some passwordVar -> - {Username = userNameVar.Value; Password = passwordVar.Value; Type = authType } - | _, _ -> - {Username = username; Password = password; Type = authType } + { Username = + EnvironmentVariable.Create(username) + |> Option.map (fun var -> var.Value) + |> Option.defaultValue username + Password = + EnvironmentVariable.Create(password) + |> Option.map (fun var -> var.Value) + |> Option.defaultValue password + Type = authType } match auth with | {Username = username; Password = password} when username = "" && password = "" -> getAuth()