Skip to content

Commit 190ea04

Browse files
authored
fix: proxyRouter empty data err panic handling (#5147)
* panic fix * set default for PROXY_SERVICE_CONFIG
1 parent 3bf0f38 commit 190ea04

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

client/proxy/ProxyRouter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type ProxyConnection struct {
2222
}
2323

2424
type Config struct {
25-
ProxyServiceConfig string `env:"PROXY_SERVICE_CONFIG" envDefault:""`
25+
ProxyServiceConfig string `env:"PROXY_SERVICE_CONFIG" envDefault:"{}"`
2626
}
2727

2828
func GetProxyConfig() (*Config, error) {
@@ -57,9 +57,9 @@ func NewProxyRouterImpl(logger *zap.SugaredLogger, proxyCfg *Config, enforcer ca
5757
proxy := make(map[string]func(writer http.ResponseWriter, request *http.Request))
5858
for s, connection := range proxyConnection {
5959
proxy[s], err = NewHTTPReverseProxy(fmt.Sprintf("http://%s:%s", connection.Host, connection.Port), client.Transport, enforcer)
60-
}
61-
if err != nil {
62-
return nil, err
60+
if err != nil {
61+
return nil, err
62+
}
6363
}
6464

6565
router := &ProxyRouterImpl{

0 commit comments

Comments
 (0)