Skip to content

Instantly share code, notes, and snippets.

@monfresh
Created March 21, 2014 03:09

Revisions

  1. monfresh created this gist Mar 21, 2014.
    42 changes: 42 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    while getopts ":a:o:" opt; do
    case $opt in
    a)
    echo "Getting ready to set environment variables for $2"

    echo "Setting CANONICAL_URL"
    heroku config:set CANONICAL_URL=$2.herokuapp.com --app $2

    echo "Setting DOMAIN_NAME"
    heroku config:set DOMAIN_NAME=herokuapp.com --app $2

    echo "Setting SECRET_TOKEN"
    token2=$(cat /dev/random | LC_CTYPE=C tr -dc "[:alnum:]" | head -c 128)
    heroku config:set SECRET_TOKEN=$token2 --app $2

    echo "Getting ready to install add-ons for $2"

    echo "Installing Mandrill by MailChimp"
    heroku addons:add mandrill --app $2

    echo "Installing Memcachier"
    heroku addons:add memcachier --app $2

    echo "Installing New Relic"
    heroku addons:add newrelic --app $2
    ;;
    o)
    echo "Setting OHANA_API_ENDPOINT"
    heroku config:set OHANA_API_ENDPOINT=$4 --app $2
    ;;
    \?)
    echo "Invalid option: -$OPTARG" >&2
    echo "Usage: setup_heroku -a your_app_name -o your_api_endpoint" >&2
    exit 1
    ;;
    :)
    echo "Option -$OPTARG requires an argument" >&2
    echo "Usage: setup_heroku -a your_app_name -o your_api_endpoint" >&2
    exit 1
    ;;
    esac
    done