Skip to content

Instantly share code, notes, and snippets.

@jbardon
Last active November 3, 2015 13:14
Show Gist options
  • Save jbardon/d3f4103d083074b40b98 to your computer and use it in GitHub Desktop.
Save jbardon/d3f4103d083074b40b98 to your computer and use it in GitHub Desktop.
Update shell variable and maven configuration with proxy settings
# Copy that in ~/.bash_profile
# Call "proxy on|off|status" in your shell
proxy(){
case $1 in
on)
export http_proxy=http://cache.etu.univ-nantes.fr:3128
export https_proxy=https://cache.etu.univ-nantes.fr:3128
sed -ie 's/false/true/g' ~/.m2/settings.xml
git config --global http.proxy http://NUM_ETUDIANT:MDP_ETUDIANT@cache.etu.univ-nantes.fr:3128
export HTTP_PROXY=http://cache.etu.univ-nantes.fr:3128
export HTTPS_PROXY=https://cache.etu.univ-nantes.fr:3128
;;
off)
export http_proxy=
export https_proxy=
export HTTP_PROXY=
export HTTPS_PROXY=
sed -ie 's/true/false/g' ~/.m2/settings.xml
git config --global http.proxy ""
;;
status)
if [ -z $(echo ${http_proxy}) ]; then
echo "Proxy off";
else
echo "Proxy on";
fi;
;;
esac;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment