1
0
Fork 0
mirror of https://github.com/Luzifer/vault2env.git synced 2024-11-08 16:20:07 +00:00

Support json.Number data format

returned on some keys in Vault 1.13

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-04-08 18:55:53 +02:00
parent fa29e46842
commit a9a8b55775
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

12
main.go
View file

@ -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
}
}
}