grpc-nvim icon indicating copy to clipboard operation
grpc-nvim copied to clipboard

Using variables to DRY and not clutter requests file

Open JPFrancoia opened this issue 1 year ago • 4 comments

Hi!

Great plugin, it's very similar to this one: https://github.com/baverman/vial-http, which I use for REST APIs. Thank you for maintaining it.

I have one question though, I'm trying to figure out if I can use variables to not clutter my requests file, and to avoid hardcoding stuff. This is what I would like to do:

grpc -H "authorization: Bearer $ACCESS_TOKEN" -plaintext localhost:50051 position.Position.RecordPosition
{
    "lat": 1234,
    "long": 42
}

I tried many variants of this command with no success. ACCESS_TOKEN is an env var in this context, but I wouldn't mind if it was just one variable at the top of the file. I really want to do that because I have many different requests using an access token, and hardcoding the token in each of them is not practical (the token changes regularly).

Is there a way to do that?

JPFrancoia avatar Dec 28 '23 14:12 JPFrancoia

Glad to hear you're finding this plugin useful!

Supporting env variables would be really nice, but isn't supported at the moment. If you're willing, I'd be happy to review + merge a patch :smile:

Otherwise, I can try to find some time to build this out myself.

hudclark avatar Jan 04 '24 21:01 hudclark

+1

Envs + variables would be great!

loeffel-io avatar Sep 05 '24 12:09 loeffel-io

Hey @hudclark, today i installed grpc-nvim and i really love it. its amazing.

Env variables would be really helpful 🙏

loeffel-io avatar Oct 25 '24 19:10 loeffel-io

Some other maybe helpful ideas:

  • functions like string to bytes (base64)
  • timing informations
  • small lsp which returns the available fields would be insane

loeffel-io avatar Oct 28 '24 12:10 loeffel-io