Support variable access across multiple scopes in scripting
I have checked the following:
- I've searched existing issues and found nothing related to my issue.
This feature
- blocks me from using Bruno
- would improve my quality of life in Bruno
- is something I've never seen an API client do before
Describe the feature you want to add, and how it would change your usage of Bruno
When using a variable as a parameter on a request, you can use '{{varName}}' and it is resolved following the scopes and precedence as described here https://docs.usebruno.com/variables/overview#variable-precedence-and-scope
But when using script functions, you have to explicitly define which scope you are accessing - bru.getVar() works with runtime,
It would be great and useful following the same variable resolution principle, if we could fallback through other scopes. I use this when I have global variables, but environment variables might override the specific values.
Either a new function would be great i.e. bru.findVar('varName') or expand the existing function with a parameter for fallback (I like this option less) i.e. bru.getVar('varName', true).
Mockups or Images of the feature
No response
Source: usebruno/bruno