Last active
November 3, 2015 13:14
-
-
Save jbardon/d3f4103d083074b40b98 to your computer and use it in GitHub Desktop.
Update shell variable and maven configuration with proxy settings
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
# 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