Skip to content

Commit

Permalink
install script: fail over to envkey-source-releases.s3.amazonaws.com …
Browse files Browse the repository at this point in the history
…(public S3 bucket controlled by EnvKey) for envkey-source binary if request to Github Releases fails--workaround for htting low Github rate limits
  • Loading branch information
danenania committed Mar 6, 2021
1 parent f4e1df6 commit 9f61cb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ curl -s https://raw.githubusercontent.com/envkey/envkey-source/master/install.sh

***Note:** the install.sh script writes, then deletes a couple temporary files to the current directory during installation, so make sure you have write permissions for whatever directory you run this command in. In locked down environments, you may want to run it in `$HOME` to be safe.*

***Another Note:** the install.sh script downloads the appropriate envkey-source binary from Github Releases by default, but Github has a fairly low rate limit for unauthenticated requests. For added redundancy, it will fail over to envkey-source-releases.s3.amazonaws.com (an S3 bucket controlled by EnvKey) and download the binary from there if the request to Github Releases fails.*

**Install manually:**

Find the [release](https://github.com/envkey/envkey-source/releases) for your platform and architecture, and stick the appropriate binary somewhere in your `PATH` (or wherever you like really).
Expand Down
12 changes: 10 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,18 @@ cleanup () {

download_envkey () {
echo "Downloading envkey-source binary for ${PLATFORM}-${ARCH}"
url="https://github.com/envkey/envkey-source/releases/download/v${VERSION}/envkey-source_${VERSION}_${PLATFORM}_${ARCH}.tar.gz"
echo "Downloading tarball from ${url}"
url="https://github.com/envkey/envkey-source/releases/download/v${VERSION}/envkey-source_${VERSION}_${PLATFORM}_${ARCH}.tar.gz"

echo "Downloading tarball from Github Releases: ${url}"
curl -s -L -o envkey-source.tar.gz "${url}"

if [ ! -f envkey-source.tar.gz ]; then
echo "Couldn't load tarball from Github Releases: ${url}"
url="https://envkey-source-releases.s3.amazonaws.com/envkey-source_${VERSION}_${PLATFORM}_${ARCH}.tar.gz"
echo "Now attempting to load from s3 bucket backup: ${url}"
curl -s -L -o envkey-source.tar.gz "${url}"
fi

tar zxf envkey-source.tar.gz envkey-source.exe 2> /dev/null
tar zxf envkey-source.tar.gz envkey-source 2> /dev/null

Expand Down

0 comments on commit 9f61cb9

Please sign in to comment.