Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
Created January 13, 2016 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-mcnally/750b75263b714253cfb6 to your computer and use it in GitHub Desktop.
Save j-mcnally/750b75263b714253cfb6 to your computer and use it in GitHub Desktop.
Grabbing a heroku app's URL on deployment. Useful for review apps that need the URL at runtime for mailers or wordpress.
#!/bin/bash
APP_URL=`php -r "print json_decode('$RECEIVE_DATA', 1)[\"push_metadata\"][\"app_info\"][\"web_url\"];"`
echo "----> APP URL DETECTED AS: $APP_URL"
echo $APP_URL > appurl.txt
#!/bin/bash
APP_URL=`ruby -e "require 'json'; require 'uri'; puts URI.parse(JSON.parse('$RECEIVE_DATA')[\"push_metadata\"][\"app_info\"][\"web_url\"]).hostname;"`
echo "----> APP URL DETECTED AS: $APP_URL"
echo $APP_URL > app_domain.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment