mirror of
https://github.com/Luzifer/vault2env.git
synced 2024-11-09 08:40:06 +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:
parent
fa29e46842
commit
a9a8b55775
1 changed files with 11 additions and 1 deletions
12
main.go
12
main.go
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
@ -149,7 +150,16 @@ func main() {
|
||||||
if newKey, ok := transformMap[key]; ok {
|
if newKey, ok := transformMap[key]; ok {
|
||||||
key = newKey
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue