Created
April 30, 2014 06:22
-
-
Save jbayer/3f6d31f06dcb26f7c325 to your computer and use it in GitHub Desktop.
Bash function demonstrating how to export the content of the buildpack compile script ENV_DIR into the environment from heroku docs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export_env_dir() { | |
env_dir=$1 | |
whitelist_regex=${2:-''} | |
blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'} | |
if [ -d "$env_dir" ]; then | |
for e in $(ls $env_dir); do | |
echo "$e" | grep -E "$whitelist_regex" | grep -qvE "$blacklist_regex" && | |
export "$e=$(cat $env_dir/$e)" | |
: | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will this be encapsulated into a library and version controlled to ensure that all buildpacks do this consistently?