tidb env 源码
tidb env 代码
文件路径:/br/pkg/utils/env.go
// Copyright 2021 PingCAP, Inc. Licensed under Apache-2.0.
package utils
import (
"github.com/pingcap/log"
"go.uber.org/zap"
"golang.org/x/net/http/httpproxy"
)
// LogEnvVariables logs related environment variables.
func LogEnvVariables() {
// log http proxy settings, it will be used in gRPC connection by default
fields := proxyFields()
if len(fields) > 0 {
log.Info("using proxy config", fields...)
}
}
func proxyFields() []zap.Field {
proxyCfg := httpproxy.FromEnvironment()
fields := make([]zap.Field, 0, 3)
if proxyCfg.HTTPProxy != "" {
fields = append(fields, zap.String("http_proxy", proxyCfg.HTTPProxy))
}
if proxyCfg.HTTPSProxy != "" {
fields = append(fields, zap.String("https_proxy", proxyCfg.HTTPSProxy))
}
if proxyCfg.NoProxy != "" {
fields = append(fields, zap.String("no_proxy", proxyCfg.NoProxy))
}
return fields
}
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦