Created
April 28, 2016 20:07
-
-
Save justinkinney/24ab3a8bc7f0cba4b33602ac9814d492 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env sh | |
# each environment key/value pair should include the bundle name as follows: | |
# RELAYBUNDLE__name__KEY=VAL | |
for key in $(env | grep RELAYBUNDLE | sed -e 's/\(.*\)__\(.*\)__\(.*\)/\1:\2:\3/g'); do | |
BUNDLE_NAME=$(echo $key | cut -d: -f2) | |
BUNDLE_KEYVAL=$(echo $key | cut -d: -f3) | |
BUNDLE_KEY=$(echo ${BUNDLE_KEYVAL} | cut -d= -f1) | |
BUNDLE_VAL=$(echo ${BUNDLE_KEYVAL} | cut -d= -f2) | |
BUNDLE_PATH="/tmp/bundle_configs/${BUNDLE_NAME}" | |
if [[ ! -d "${BUNDLE_PATH}" ]]; then | |
mkdir -p "${BUNDLE_PATH}" | |
fi | |
echo -e "${BUNDLE_KEY}: \"${BUNDLE_VAL}\"" >> "${BUNDLE_PATH}/config.yaml" | |
done | |
exec $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment