Add UseProxy config.

This commit is contained in:
Yang Luo 2021-02-14 17:24:05 +08:00
parent b5b86262d6
commit 15f9d71127
2 changed files with 8 additions and 3 deletions

View File

@ -5,3 +5,4 @@ SessionOn = true
copyrequestbody = true
dataSourceName = root:123@tcp(localhost:3306)/
AuthState = "casdoor"
UseProxy = false

View File

@ -17,14 +17,18 @@ package controllers
import (
"net/http"
"github.com/astaxie/beego"
"golang.org/x/net/proxy"
)
var httpClient *http.Client
var UseOAuthProxy = true
func InitHttpClient() {
if !UseOAuthProxy {
useProxy, err := beego.AppConfig.Bool("UseProxy")
if err != nil {
panic(err)
}
if !useProxy{
httpClient = &http.Client{}
return
}