feat(shell-proxy): enable unexported DEFAULT_PROXY setting (#9774)

This commit is contained in:
Septs 2021-04-06 20:49:03 +08:00 committed by GitHub
parent 790f185e0f
commit 2e487b187e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -9,8 +9,9 @@ user_proxy = os.environ.get("CONFIG_PROXY", os.path.expandvars("$HOME/.config/pr
def get_http_proxy():
if "DEFAULT_PROXY" in os.environ:
return os.environ["DEFAULT_PROXY"]
default_proxy = os.environ.get("DEFAULT_PROXY")
if default_proxy:
return default_proxy
if os.path.isfile(user_proxy):
return check_output(user_proxy).decode("utf-8").strip()
raise Exception("Not found, Proxy configuration")

View File

@ -4,7 +4,7 @@
__PROXY__="${0:A:h}/proxy.py"
proxy() {
source <("$__PROXY__" "$1")
source <(env "DEFAULT_PROXY=$DEFAULT_PROXY" "$__PROXY__" "$1")
}
_proxy() {