@@ -6,16 +6,12 @@ Authors: Arthur Paulino
66
77import Batteries.Data.String.Matcher
88import Cache.Hashing
9+ import Cache.Init
910
1011namespace Cache.Requests
1112
1213open System (FilePath)
1314
14- -- FRO cache may be flaky: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/The.20cache.20doesn't.20work/near/411058849
15- initialize useFROCache : Bool ← do
16- let froCache ← IO.getEnv "USE_FRO_CACHE"
17- return froCache == some "1" || froCache == some "true"
18-
1915/--
2016Structure to hold repository information with priority ordering
2117-/
@@ -244,11 +240,14 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
244240 return {repo := repo, useFirst := false }
245241
246242/-- Public URL for mathlib cache -/
247- def URL : String :=
248- if useFROCache then
249- "https://mathlib4.lean-cache.cloud"
250- else
251- "https://lakecache.blob.core.windows.net/mathlib4"
243+ initialize URL : String ← do
244+ let url? ← IO.getEnv "MATHLIB_CACHE_GET_URL"
245+ let defaultUrl :=
246+ if useFROCache then
247+ "https://mathlib4.lean-cache.cloud"
248+ else
249+ "https://lakecache.blob.core.windows.net/mathlib4"
250+ return url?.getD defaultUrl
252251
253252/-- Retrieves the azure token from the environment -/
254253def getToken : IO String := do
@@ -508,11 +507,14 @@ end Get
508507section Put
509508
510509/-- FRO cache S3 URL -/
511- def UPLOAD_URL : String :=
512- if useFROCache then
513- "https://a09a7664adc082e00f294ac190827820.r2.cloudflarestorage.com/mathlib4"
514- else
515- URL
510+ initialize UPLOAD_URL : String ← do
511+ let url? ← IO.getEnv "MATHLIB_CACHE_PUT_URL"
512+ let defaultUrl :=
513+ if useFROCache then
514+ "https://a09a7664adc082e00f294ac190827820.r2.cloudflarestorage.com/mathlib4"
515+ else
516+ "https://lakecache.blob.core.windows.net/mathlib4"
517+ return url?.getD defaultUrl
516518
517519/-- Formats the config file for `curl`, containing the list of files to be uploaded -/
518520def mkPutConfigContent (repo : String) (fileNames : Array String) (token : String) : IO String := do
0 commit comments