Skip to content
Snippets Groups Projects

Add opt to set default grpc scheme to passtrough

Merged Neil-Jocelyn Schark requested to merge add-passthrough-flag into master
Files
3
+ 9
0
@@ -43,6 +43,7 @@ import (
@@ -43,6 +43,7 @@ import (
gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model"
gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model"
"github.com/google/uuid"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
 
"google.golang.org/grpc/resolver"
"gopkg.in/yaml.v3"
"gopkg.in/yaml.v3"
)
)
@@ -54,9 +55,17 @@ func main() {
@@ -54,9 +55,17 @@ func main() {
certFile := flag.String("certFile", "", "location of the gNMI cert file (overwrites settings in config file)")
certFile := flag.String("certFile", "", "location of the gNMI cert file (overwrites settings in config file)")
keyFile := flag.String("keyFile", "", "location of the gNMI key file (overwrites settings in config file)")
keyFile := flag.String("keyFile", "", "location of the gNMI key file (overwrites settings in config file)")
caFile := flag.String("caFile", "", "location of the gNMI ca file (overwrites settings in config file)")
caFile := flag.String("caFile", "", "location of the gNMI ca file (overwrites settings in config file)")
 
gRPCPassthrough := flag.Bool("grpcPassthrough", true, "set the default resolve scheme for grpc to passthrough, default is true")
flag.Parse()
flag.Parse()
 
if *gRPCPassthrough {
 
log.Info("Setting gRPC default resolver scheme to passthrough. No DNS queries are being made when doing a gRPC request.")
 
resolver.SetDefaultScheme("passthrough")
 
} else {
 
log.Info("gRPC default resolver scheme is not set to passthrough. This might cause issues with the gRPC connection when no real DNS server is available as each gRPC requests requires a DNS request.")
 
}
 
// parse string, this is built-in feature of logrus
// parse string, this is built-in feature of logrus
ll, err := log.ParseLevel(*logLevel)
ll, err := log.ParseLevel(*logLevel)
if err != nil {
if err != nil {
Loading