From 9d4049cfe39418ec6227e4608728bbc0b2054cf3 Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Tue, 2 Aug 2022 00:47:20 +0400 Subject: [PATCH] [#186] Don't print env vars with empty values Signed-off-by: Angira Kekteeva --- settings.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/settings.go b/settings.go index c6ad084..52de560 100644 --- a/settings.go +++ b/settings.go @@ -182,8 +182,13 @@ func settings() *viper.Viper { continue } + defaultValue := v.GetString(keys[i]) + if len(defaultValue) == 0 { + continue + } + k := strings.Replace(keys[i], ".", "_", -1) - fmt.Printf("%s_%s = %v\n", Prefix, strings.ToUpper(k), v.Get(keys[i])) + fmt.Printf("%s_%s = %s\n", Prefix, strings.ToUpper(k), defaultValue) } fmt.Println()