geofffranks / spruce

A BOSH template merge tool
MIT License
431 stars 78 forks source link

Environment variable json converted by "grab" #301

Closed arun-a-nayagam closed 4 years ago

arun-a-nayagam commented 4 years ago

Hi,

I have an environment variable that's a json. And when I use grab it converts it to a yaml. Is there a way to get the json as is.

Issue described here, https://play.spruce.cf/#8b9e7ac7285f45c49eeb849c587b5742

Thanks, Arun

geofffranks commented 4 years ago

Currently this can't be disabled. It was mainly designed to convert numerics/boolean environment variables into the correct types, rather than as strings. This could be added as a flag to disable all unmarshaling of env var data, or prevent it from unmarshaling strictly map/array data-structures if desired.

Alternatively, you could do something like this:

meta:
   json: (( file "my-file.json" ))
admin:
  json: (( grab meta.json ))
arun-a-nayagam commented 4 years ago

Hi, Thank you for the reply. I had to go for the file approach and that worked fine. Appreciate your help. Thanks, Arun