-
-
Save jakeatwork/82d17433221d4dc36e02ec0ccc0981b3 to your computer and use it in GitHub Desktop.
Revisions
-
ktec revised this gist
Nov 25, 2016 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,8 @@ main() { TARGET="${2}" vars="" echo "Please choose the ENV variables you wish to copy from $SOURCE to $TARGET:" echo "" while read key value; do key=${key%%:} @@ -46,9 +47,14 @@ main() { fi done < <(heroku config --app "$SOURCE" | sed -e '1d') echo "" echo "--------------------------------------------------------------------" echo "This script will not do your dirty work for you. Below is the script" echo "you will need to run to update your heroku app instance. Good luck! " echo "--------------------------------------------------------------------" echo "" echo "heroku config:set$vars --app $TARGET" echo "" } set -e # exit on command errors -
ktec revised this gist
Nov 25, 2016 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ #!/usr/bin/env bash # Original Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/ ## Usage: heroku_env_copy [options] SOURCE TARGET ## ## NOTE: This script will only output the command, you should run it yourself. ## ## Options: ## -h, --help Display this message. ## usage() { @@ -18,7 +18,6 @@ usage() { main() { while [ $# -gt 0 ]; do case $1 in (-h|--help) usage 2>&1;; (--) break;; (-*) usage "$1: unknown option";; @@ -29,26 +28,27 @@ main() { SOURCE="${1}" TARGET="${2}" vars="" echo "Select the ENV variables you want to copy from $SOURCE to $TARGET:" while read key value; do key=${key%%:} read -p "Include: $key=$value ? [Y/n] (default yes) " -u 1 response if printf "%s\n" "$response" | grep -Eq "$(locale noexpr)" then tput cuu 1 && tput el echo -e "$(tput setaf 9)Copy: $key=$value ? No$(tput sgr0)" else tput cuu 1 && tput el echo -e "$(tput setaf 2)Copy: $key=$value ? Yes$(tput sgr0)" vars=$vars" $key=\"$value\"" fi done < <(heroku config --app "$SOURCE" | sed -e '1d') echo "--------------------------------------------------------------------" echo "This is the command you need to run to update your heroku app:" echo "heroku config:set$vars --app $TARGET" } set -e # exit on command errors -
ktec created this gist
Nov 25, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ #!/usr/bin/env bash # Original Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/ ## Usage: heroku_env_copy [options] SOURCE TARGET ## ## Options: ## -h, --help Display this message. ## -n Dry-run; only show what would be done. ## usage() { [ "$*" ] && echo "$0: $*" sed -n '/^##/,/^$/s/^## \{0,1\}//p' "$0" exit 2 } 2>/dev/null main() { while [ $# -gt 0 ]; do case $1 in (-n) DRY_RUN=1;; (-h|--help) usage 2>&1;; (--) break;; (-*) usage "$1: unknown option";; (*) break;; esac shift done SOURCE="${1}" TARGET="${2}" echo "Would you like me to copy the following ENV variables from $SOURCE to $TARGET:" while read key value; do key=${key%%:} read -p "Copy: $key=$value ? [Y/n] (default yes) " -u 1 response if printf "%s\n" "$response" | grep -Eq "$(locale noexpr)" then tput cuu 1 && tput el echo -e "$(tput setaf 9)Copy: $key=$value ? No$(tput sgr0)" else tput cuu 1 && tput el echo -e "$(tput setaf 2)Copy: $key=$value ? Yes$(tput sgr0)" if [[ ! DRY_RUN ]]; then heroku config:set "$key=$value" --app "$TARGET" else echo "action: heroku config:set "$key=$value" --app "$TARGET"" fi fi done < <(heroku config --app "$SOURCE" | sed -e '1d') } set -e # exit on command errors main $@