mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 忽略环境变量中的代理设置 Fix https://github.com/siyuan-note/siyuan/issues/5377
This commit is contained in:
parent
289d7e820b
commit
2880222bc6
2 changed files with 16 additions and 0 deletions
|
|
@ -304,6 +304,8 @@ func InitConf() {
|
|||
Environment: util.Mode,
|
||||
})
|
||||
}
|
||||
|
||||
util.SetNetworkProxy(Conf.System.NetworkProxy.String())
|
||||
}
|
||||
|
||||
var langs = map[string]map[int]string{}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
|
@ -74,3 +75,16 @@ func GetDeviceID() string {
|
|||
}
|
||||
return gulu.Rand.String(12)
|
||||
}
|
||||
|
||||
func SetNetworkProxy(proxyURL string) {
|
||||
if err := os.Setenv("HTTPS_PROXY", proxyURL); nil != err {
|
||||
logger.Errorf("set env [HTTPS_PROXY] failed: %s", err)
|
||||
}
|
||||
if err := os.Setenv("HTTP_PROXY", proxyURL); nil != err {
|
||||
logger.Errorf("set env [HTTP_PROXY] failed: %s", err)
|
||||
}
|
||||
|
||||
if "" != proxyURL {
|
||||
logger.Infof("use network proxy [%s]", proxyURL)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue