mirror of https://github.com/knative/docs.git
samples/grpc-ping-go: don't provide default (#959)
I was trying to connect to my grpc service at a custom domain like `grpc-ping.default.IP.IP.IP.IP.xip.io` while omitting -server_host_override and it resulted in bug https://github.com/knative/serving/issues/3307 which took several days to figure out there was a default value for this flag. Removing the default value as nobody's really owning grpc.knative.dev or setting it as the custom domain in this sample. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
74fa88ef49
commit
9f04556a89
|
@ -16,14 +16,17 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
serverAddr = flag.String("server_addr", "127.0.0.1:8080", "The server address in the format of host:port")
|
serverAddr = flag.String("server_addr", "127.0.0.1:8080", "The server address in the format of host:port")
|
||||||
serverHostOverride = flag.String("server_host_override", "grpc.knative.dev", "")
|
serverHostOverride = flag.String("server_host_override", "", "")
|
||||||
insecure = flag.Bool("insecure", false, "Set to true to skip SSL validation")
|
insecure = flag.Bool("insecure", false, "Set to true to skip SSL validation")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
opts := []grpc.DialOption{grpc.WithAuthority(*serverHostOverride)}
|
var opts []grpc.DialOption
|
||||||
|
if *serverHostOverride != "" {
|
||||||
|
opts = append(opts, grpc.WithAuthority(*serverHostOverride))
|
||||||
|
}
|
||||||
if *insecure {
|
if *insecure {
|
||||||
opts = append(opts, grpc.WithInsecure())
|
opts = append(opts, grpc.WithInsecure())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue