Created
June 25, 2017 01:43
-
-
Save irazasyed/327fce1535cef4a5501d185659b078fa to your computer and use it in GitHub Desktop.
Laravel Valet Share with Sub-Domain Support
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
# 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you guild how to run this?