addet proxy for corporate networks

This commit is contained in:
piecka 2025-02-21 12:50:29 +01:00
parent 80b519f3d1
commit c34fe00c1a

20
.zshrc
View file

@ -7,6 +7,25 @@ LIGHT_GREEN='\033[0;92m'
BOLD='\033[1m' BOLD='\033[1m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
_proxy() {
local ip="172.22.11.69"
local port="8080"
# Check if the IP and port are reachable
if nc -z -w5 $ip $port; then
# If reachable, set the proxy environment variables
export http_proxy="http://$ip:$port"
export https_proxy="http://$ip:$port"
export HTTP_PROXY="http://$ip:$port"
export HTTPS_PROXY="http://$ip:$port"
echo_info "Proxy set to: http://$ip:$port"
else
echo_error "IP $ip with port $port is not reachable."
fi
alias proxy='echo "http: $HTTP_PROXY"; echo "https: $HTTPS_PROXY"'
}
# Message storage # Message storage
typeset -A _MESSAGES typeset -A _MESSAGES
_MESSAGES=( _MESSAGES=(
@ -118,6 +137,7 @@ _sources() {
} }
_environment() { _environment() {
_proxy
if command_exists nvim; then if command_exists nvim; then
export EDITOR="$(which nvim)" export EDITOR="$(which nvim)"
fi fi