From b0c825098a4ce49307216cf2c918630385d0dbf9 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 7 Aug 2017 15:36:42 +0200 Subject: [PATCH] Fix: Do not try to access data on error Signed-off-by: Knut Ahlers --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 6c94ab9..f4a2d71 100644 --- a/main.go +++ b/main.go @@ -114,7 +114,13 @@ func main() { for _, vaultKey := range cfg.VaultKeys { data, err := client.Logical().Read(vaultKey) if err != nil { - log.Errorf("Unable to fetch data: %s", err) + log.Errorf("Unable to fetch data for key %q: %s", vaultKey, err) + continue + } + + if data.Data == nil { + log.Errorf("Vault key %q did not contain data", vaultKey) + continue } for k, v := range data.Data {