Closed mkobit closed 4 years ago
I'm not sure how easy it will be to implement this in Go the way you've requested to be honest. (handling complex/nested) objects.
Would allowing JSON on the CLI meet your needs? Or is that not a useful feature?
goss --vars '{"ip": {"addr": [1.1.1.1, 2.2.2.2]}}' validate
Tagging @pedroMMM since he :+1: this, would love your feedback also.
In my use case, I was calling Goss from Packer and I needed to inject multiple runtime values alongside my variables file to Goss. In my case, I just got around it by forking and expanding the Goss Packer Provisioner to support exactly what you just described since the Provisioner was already moving the variables file to the instance.
I support adding a --vars-inline '{...}'
variable since it will enable users to run Goss for ad hoc testing/debugging but also in more complex scenarios like mine. To be clear the --vars-inline
will be loaded after the --vars
which means that keys from inline (that overlap) will overwrite those that were sourced from the file. This will have to be made clear to users.
Yup, documentation should be clear that not only will vars-inline win, but no advanced deep merging will be done.
released
Some shells don't have process substitution, and environment variables can't be structured as easily when you want to pass in multiple inputs. It could be useful to pass in
--vars
without modifying a file for adhoc testing, or for just running things without requiring avars
file at all.A possible example