Support arguments to yaml templates
prashantv opened this issue · 4 comments
We often have common queries (either for testing, or administration) that have some parameters.
It would be nice if we could use a YAML template and parameterize parts of it (e.g., the service name, or some part of the request body).
E.g., if --health
didn't exist, we might have a yaml template like:
#!/usr/bin/yab -y
service: $service
thrift: ./idl/meta.health
procedure: Meta::health
body:
user: ${user:prashant}
And we could do ./health.yaml --arg service:foo --arg user:foo
I saw that we now have support for YAML templates (so awesome!), but did argument support come with that?
Not yet! We have a bit of work to do before we can do argument support:
- add parser for the
${user:prashant}
style of syntax. This will be based on the work done by @abhinav for YARPC configuration. The parser will need some changes (allow specifying a literal$
, possibly quoting for values inside, etc - add a pre-processor that evaluates a
map[string]interface{}
replacing any arguments
It will probably take a couple of weeks but is definitely on our roadmap (especially pre 1.0)
Recommending -A
for short, to sit with -H
and -B
.
Config is environment driven. Should we use environment for template arguments?
Hmm, falling back to environment variables does seem nice, although they tend to be uppercase.
What if we supported ${user:USER:prashant}
to specify preferences, or is that getting too complicated?