Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created June 25, 2017 01:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save irazasyed/327fce1535cef4a5501d185659b078fa to your computer and use it in GitHub Desktop.
Save irazasyed/327fce1535cef4a5501d185659b078fa to your computer and use it in GitHub Desktop.
Laravel Valet Share with Sub-Domain Support
# Tunnels to valet project with custom domain name.
# Uses ngrok.com with my personal github account and auth token
function tunnel_valet() {
HOST="${PWD##*/}"
DOMAIN=$(valet domain)
SUBDOMAIN="$HOST"
[[ "$1" ]] && SUBDOMAIN=$1;
for linkname in ~/.valet/Sites/*; do
if [[ "$(readlink $linkname)" = "$PWD" ]]
then
HOST="${linkname##*/}"
fi
done
# Fetch Ngrok URL In Background...
bash valet fetch-share-url &
sudo -u $(logname) ngrok http "$HOST.$DOMAIN:80" -subdomain="$HOST" -host-header=rewrite ${*:2}
exit
}
@voeurnchy
Copy link

can you guild how to run this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment