Skip to content

Commit

Permalink
Support Heroku's new ENV_DIR option
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhammond committed Mar 10, 2014
1 parent 6ed69f6 commit be504e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ buckets. It gives you a way of deploying pre-built code to
You probably want to use an [IAM key](http://aws.amazon.com/iam/) with limited
access. This code only requires `s3:GetObject` access to files.

If you don't want to check your IAM keys into revision control, you can use
the [Heroku Labs user-env-compile feature](https://devcenter.heroku.com/articles/labs-user-env-compile)
to store the keys in Heroku's config system. Note that this is a beta feature
and Heroku may remove it at any time:
If you don't want to check your IAM keys into revision control, you can store
them in Heroku's config system. Keys specified in the .buildpack-s3-tarballs
file have precedence over keys in the config system.

$ heroku config:add BUILDPACK_URL=https://github.com/paulhammond/s3-tarball-buildpack.git
$ heroku labs:enable user-env-compile
$ heroku config:add AWS_ACCESS_KEY_ID=AKIA0000000000000000
$ heroku config:add AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Expand Down
9 changes: 8 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash
# bin/compile <build-dir> <cache-dir>
# bin/compile <build-dir> <cache-dir> <env-dir>
# See https://github.com/paulhammond/s3-tarball-buildpack for license and docs

working=$(pwd)
mkdir -p "$2"
build=$(cd "$1/" && pwd)
cache=$(cd "$2/" && pwd)
env=$(cd "$3/" && pwd)

# s3simple is a small, simple bash s3 client with minimal dependencies.
# See http://github.com/paulhammond/s3simple for documentation and licence.
Expand Down Expand Up @@ -62,6 +63,12 @@ s3simple() {

cd $build

for e in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY; do
if [ -f $env/$e ]; then
export "$e=$(cat $env/$e)"
fi
done

while read line; do
case "$line" in
AWS_*=*)
Expand Down

0 comments on commit be504e8

Please sign in to comment.