From a9a8b557752078742d6474ae5c96d5b3f10b88c9 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 8 Apr 2023 18:55:53 +0200 Subject: [PATCH] Support `json.Number` data format returned on some keys in Vault 1.13 Signed-off-by: Knut Ahlers --- main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 172593b..4a180bd 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" "io/ioutil" "os" @@ -149,7 +150,16 @@ func main() { if newKey, ok := transformMap[key]; ok { key = newKey } - envData[key] = v.(string) + + switch vI := v.(type) { + case string: + envData[key] = vI + case json.Number: + envData[key] = string(vI) + default: + log.Errorf("Vault key %q.%q contained unexpected data type %T", vaultKey, k, v) + continue + } } }