uhop / node-re2

node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.
Other
495 stars 53 forks source link

allow overriding download url with RE2_DOWNLOAD_MIRROR #74

Closed spalger closed 4 years ago

spalger commented 4 years ago

In our CI the re2 download failed for a while last night, which is a phenomenon we observe on a fairly regular basis with packages that download assets in their post install step from public urls. We prevent this from failing our CI by mirroring downloads within our CI environment. To do this we override download URLs for a number of packages which support this using environment variables:

export GECKODRIVER_CDNURL="..."
export CHROMEDRIVER_CDNURL="..."
export CYPRESS_DOWNLOAD_MIRROR="..."

These URLs are static and point to a prefix where the different packages will request the assets they seek to download, and we don't experience the same random failures we do when using public urls.

It would be great if node-re2 supported this as well, so I've added a check for the RE2_DOWNLOAD_MIRROR environment variable, and when it's defined it will override the https://github.com part of the download URL.

spalger commented 4 years ago

Sure thing, I'll send another PR

uhop commented 4 years ago

I reorganized the project by splitting off the artifact caching utilities to their own repositories. See 1.15.3. Please verify if this change works for you and didn't break anything.

spalger commented 4 years ago

Nice, I'll give it a shot tomorrow

spalger commented 4 years ago

Thanks again, works great :)