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 for collection/folder level variables #823

Closed
Santhosh136 opened this issue Oct 6, 2022 · 11 comments
Closed

Support for collection/folder level variables #823

Santhosh136 opened this issue Oct 6, 2022 · 11 comments
Labels
feature request New feature or request

Comments

@Santhosh136
Copy link

Would be great if we can have collection level variables like postman. This will help us avoid switching between environments which requires multiple clicks.

@Santhosh136 Santhosh136 added the feature request New feature or request label Oct 6, 2022
@rangav
Copy link
Collaborator

rangav commented Oct 6, 2022

Hi @Santhosh136

we have option attach env to collection in collection settings view

did you try that?

@Santhosh136
Copy link
Author

Hi @rangav,
Yeah I've tried that.. thanks! It would be nice if we have folder level variables also...

@Santhosh136 Santhosh136 changed the title Support for collection level variables Support for collection/folder level variables Oct 11, 2022
@benoitmasson
Copy link

I'd like to add a use case:
my environments contain some variables shared among collections (dev/prod URLs), but I'd also like to use collection-level variables to add data shared across environments.

Attaching an env will not do the job, since then a collection would be tied to a dev/prod URL.

@rangav
Copy link
Collaborator

rangav commented Nov 4, 2022

@benoitmasson then you can try use global env variables, which can be accessed from any collection.

@benoitmasson
Copy link

Hi, let me be more concrete:

  • I have 2 web APIs in the same git repository, namely foo and bar, which share the same thunder-tests configuration folder. I have 2 collections, 1 per API, each one with its own base URL defined as {{base_url}} variable value
  • I have 2 environments, dev and prod, with different different base_url variable values. Let's say that dev is http://localhost:8080, and prod is https://{{app_name}}.company.com

I would like to add the app_name variable to the collection, so that all 4 app-env combinations resolve correctly the final base URL. I'm not sure this is the best way to do it, but I wasn't able to find another one.
I don't think that shared global env variables would be a solution, since that would imply that either the app_name value or the base_url pattern is shared across apps or envs.

@rangav
Copy link
Collaborator

rangav commented Nov 7, 2022

@benoitmasson I think having app_name variable in global env is easy option.

or create app_name variable in both environments

@benoitmasson
Copy link

Thanks, but from my understanding, this would not work since then, both foo and bar in prod env would share the same app_name (whether it's taken from the shared global env, or from the same prod env) and hence the same base URL.

What I want is:

  • foo (collection) in dev (env) to point to http://localhost:8080
  • bar in dev to point to http://localhost:8080
  • foo in prod to point to https://foo.company.com
  • bar in prod to point to https://bar.company.com

@rangav
Copy link
Collaborator

rangav commented Nov 7, 2022

then you can do the following

foo collection set baseUrl as {{baseUrl1}}
bar collection set baseUrl as {{baseUrl2}}

in dev env - baseUrl1 set value to http://localhost:8080
in dev dev - baseUrl2 set value to http://localhost:8080

in prod env - baseUrl1 set value to https://foo.company.com
in prod dev - baseUrl2 set value to https://bar.company.com

@benoitmasson
Copy link

I didn't think about that (expected something more generic), but that could work indeed. Thanks for the tip!

@rangav
Copy link
Collaborator

rangav commented Nov 8, 2022

you are welcome. I am closing the issue, feel free to re-open if needed

@rangav
Copy link
Collaborator

rangav commented Oct 19, 2023

This feature is implemented and published to the marketplace, please update to v2.14.0

https://github.com/rangav/thunder-client-support/releases/tag/v2.14.0

Please test and let me know your feedback.

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

No branches or pull requests

3 participants