Skip to content

Commit a044e34

Browse files
committed
Lazy load envvar
1 parent 0eb7659 commit a044e34

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

build/build.fs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ let docsSiteBaseUrl = sprintf "https://%s.github.io/%s" gitOwner gitRepoName
9292

9393
let disableCodeCoverage = environVarAsBoolOrDefault "DISABLE_COVERAGE" false
9494

95-
let githubToken = Environment.environVarOrNone "GITHUB_TOKEN"
95+
let githubToken = lazy (Environment.environVarOrNone "GITHUB_TOKEN")
9696

97-
98-
let nugetToken = Environment.environVarOrNone "NUGET_TOKEN"
97+
let nugetToken =
98+
lazy
99+
(Environment.environVarOrNone "NUGET_TOKEN")
99100

100101
//-----------------------------------------------------------------------------
101102
// Helpers
@@ -557,7 +558,7 @@ let publishToNuget _ =
557558
ToolType = ToolType.CreateLocalTool()
558559
PublishUrl = publishUrl
559560
WorkingDir = "dist"
560-
ApiKey = match nugetToken with
561+
ApiKey = match nugetToken.Value with
561562
| Some s -> s
562563
| _ -> c.ApiKey // assume paket-config was set properly
563564
}
@@ -587,7 +588,7 @@ let gitRelease _ =
587588
let githubRelease _ =
588589
allReleaseChecks ()
589590
let token =
590-
match githubToken with
591+
match githubToken.Value with
591592
| Some s -> s
592593
| _ -> failwith "please set the github_token environment variable to a github personal access token with repo access."
593594

@@ -665,8 +666,8 @@ let initTargets () =
665666
//-----------------------------------------------------------------------------
666667
// Hide Secrets in Logger
667668
//-----------------------------------------------------------------------------
668-
Option.iter(TraceSecrets.register "<GITHUB_TOKEN>" ) githubToken
669-
Option.iter(TraceSecrets.register "<NUGET_TOKEN>") nugetToken
669+
Option.iter(TraceSecrets.register "<GITHUB_TOKEN>" ) githubToken.Value
670+
Option.iter(TraceSecrets.register "<NUGET_TOKEN>") nugetToken.Value
670671
//-----------------------------------------------------------------------------
671672
// Target Declaration
672673
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)