hudclark / grpc-nvim

Grpc Client for Neovim
MIT License
31 stars 1 forks source link

Using variables to DRY and not clutter requests file #5

Open JPFrancoia opened 8 months ago

JPFrancoia commented 8 months ago

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?

hudclark commented 8 months ago

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.

loeffel-io commented 1 week ago

+1

Envs + variables would be great!