Open remche opened 1 year ago
That's an interesting proposal, and I definitely see the use case. However, I'm a bit skeptical about the specific implementation for two reasons:
Perhaps this could work better if implemented through standard shell environment variables. Two possible ways to implement it:
export jwt_token="$(gopass show pass/mytoken)"
before running neovim, and the existing environment variables are joined to the lookup map, so you can use ${jwt_token}
in your requests. Support for .env
files is also on my roadmap, but I don't think it would solve your specific use-case - you need dynamic, not static variables.{
"dev": {
"__before__": "scripts/setup.dev.sh",
"base_url": "http://localhost:3000"
}
}
Then scripts/setup.dev.sh
would look like this:
export jwt_token="$(gopass show pass/mytoken)"
This would actually be quite powerful because it would enable to run any custom logic before a request (not only variables), and it may also allow for an __after__
script that can e.g. cleanup things after a request.
How would you consider these options?
@BlackLight thanks for the feedback, I totally agree that my proposed implementation is not relevant, it was more to get the idea.
In my workflow, the first and easiest implementation is the best : I use a "lightweight workspace manager" (https://github.com/jamesob/desk), in fact mainly a bunch of shell script setting environment variables. I can rely on this variables to pimp the JSON.
Congrats for the great work on this plugin !
Would it be worth considering to use a command for the json variables values ? ie something like :