Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arguments to yaml templates #153

Open
prashantv opened this issue Feb 14, 2017 · 4 comments
Open

Support arguments to yaml templates #153

prashantv opened this issue Feb 14, 2017 · 4 comments

Comments

@prashantv
Copy link
Contributor

prashantv commented Feb 14, 2017

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

@minglecm
Copy link

minglecm commented Mar 6, 2017

I saw that we now have support for YAML templates (so awesome!), but did argument support come with that?

@prashantv
Copy link
Contributor Author

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)

@kriskowal
Copy link
Contributor

Recommending -A for short, to sit with -H and -B.

Config is environment driven. Should we use environment for template arguments?

@prashantv
Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants