From 0bc19ce64e03f55d57c29d9bc5b12c36c6af929e Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 23 May 2022 12:36:52 -0400 Subject: [PATCH] fix: chain unary interceptors instead of overwriting --- cmd/zed/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/zed/main.go b/cmd/zed/main.go index 5ee3a3ea..17b40b32 100644 --- a/cmd/zed/main.go +++ b/cmd/zed/main.go @@ -37,12 +37,18 @@ func defaultStorage() (storage.ConfigStore, storage.SecretStore) { } func dialOptsFromFlags(cmd *cobra.Command, token storage.Token) []grpc.DialOption { - opts := []grpc.DialOption{ - grpc.WithUnaryInterceptor(zgrpcutil.LogDispatchTrailers), + grpc.WithChainUnaryInterceptor() + + interceptors := []grpc.UnaryClientInterceptor{ + zgrpcutil.LogDispatchTrailers, } if !cobrautil.MustGetBool(cmd, "skip-version-check") { - opts = append(opts, grpc.WithUnaryInterceptor(zgrpcutil.CheckServerVersion)) + interceptors = append(interceptors, zgrpcutil.CheckServerVersion) + } + + opts := []grpc.DialOption{ + grpc.WithChainUnaryInterceptor(interceptors...), } if cobrautil.MustGetBool(cmd, "insecure") || (token.IsInsecure()) {