Skip to content

Instantly share code, notes, and snippets.

@ch0c01d
Created June 18, 2016 21:29
Show Gist options
  • Save ch0c01d/784e6cabd80b110dc4c66ddce107054b to your computer and use it in GitHub Desktop.
Save ch0c01d/784e6cabd80b110dc4c66ddce107054b to your computer and use it in GitHub Desktop.
BASHRC for Ngrok configuration
ngrok_tunnel() {
website=$1
subdomain=$2
username=$3
password=$4
[ -n $website ] && website="-host-header=${website}" || (echo "Onii-sama, dev yg mana yg mau di publish ?" && exit)
[ -n $subdomain ] && subdomain="-subdomain=${subdomain}"
if [[ -n $username ]] && [[ -n $password ]]; then
httpauth="-httpauth=${username}:${password}"
echo "Ok Onii-sama, profil akses diubah ke private."
else
echo "Ok Onii-sama, profil akses diubah ke public."
fi
ngrok http $website $subdomain 80 $httpauth
}
#tunnel localhost to public
publish() {
ngrok_tunnel $1 $2 $3 $4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment