From e5d15f1d2003133e0ade78a1507813f955153223 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Wed, 16 Sep 2020 17:45:29 +0200 Subject: [PATCH] Low deprecation warning only when deprecated flags are set Signed-off-by: Pavol Loffay --- cmd/query/app/flags.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/query/app/flags.go b/cmd/query/app/flags.go index 2ced798262f..62333966e25 100644 --- a/cmd/query/app/flags.go +++ b/cmd/query/app/flags.go @@ -108,7 +108,9 @@ func (qOpts *QueryOptions) InitPortsConfigFromViper(v *viper.Viper, logger *zap. if !(v.IsSet(queryHostPort) || v.IsSet(queryPort)) && (v.IsSet(queryHTTPHostPort) || v.IsSet(queryGRPCHostPort)) { return qOpts } - logger.Warn(fmt.Sprintf("Use of %s and %s is deprecated. Use %s and %s instead", queryPort, queryHostPort, queryHTTPHostPort, queryGRPCHostPort)) + if v.IsSet(queryHostPort) || v.IsSet(queryPort) { + logger.Warn(fmt.Sprintf("Use of %s and %s is deprecated. Use %s and %s instead", queryPort, queryHostPort, queryHTTPHostPort, queryGRPCHostPort)) + } qOpts.HTTPHostPort = qOpts.HostPort qOpts.GRPCHostPort = qOpts.HostPort return qOpts