-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Global Environments #115
Comments
This is actually by design. In the postman world, Workspaces are the first class citizen, Collections and Environments are under workspaces. This paradigm has been the defacto way of thinking for a decade, and every other alternative (Insomnia, Hoppscotch etc) start with the same paradigm. With Bruno, we see collections as a first class citizen. Everything related to a collection resides inside the collection including env variables. If you have a payment service, you would save your bruno collections inside a payments-api
|-- src
|-- collection
|--environments
|-- prod.bru
|-- stg.bru
|--get payments.bru
|--create payment.bru If you are not storing bruno collections inside a repo, but you are using a separate git repo to store collections, that is also fine. I have two questions
|
|
Nice! One way to quickly clone environments is to copy the You can copy folder using file explorer or do it via vscode by open collections inside vscode. At this point, i don't think we may support global environments, as we see collection as the first class citizen, and everything related to collection (envs, vars, tests, scripts) resides inside the collection |
One of the options I am thinking is to support a flow in the UI for importing environments environments from any other collections. |
Hi! Sorry to bump such an old issue, but I just came across Bruno (which I love, by the way) and stumbled upon this issue after importing my second collection. I get what you say about seeing collections as the first-class entity here. But in the end, that is highly dependent on the specific projects you're working on. For instance, in my case, things look more like this: project-root
|-- dev-env
|--api-1
|-- GET
|-- PUT
|-- DELETE
|--api-2
|-- GET
|-- PUT
|-- DELETE
|--api-3
|-- GET
|-- PUT
|-- DELETE
|-- staging-env
|--api-1
|-- GET
|-- PUT
|-- DELETE
|--api-2
|-- GET
|-- PUT
|-- DELETE
|--api-3
|-- GET
|-- PUT
|-- DELETE
|-- production-env
|--api-1
|-- GET
|-- PUT
|-- DELETE
|--api-2
|-- GET
|-- PUT
|-- DELETE
|--api-3
|-- GET
|-- PUT
|-- DELETE So all APIs share a common ancestor - the current environment. That means they ALL have the same base URL, same OAuth2 endpoint, same client credentials and tokens for OAuth2, etc. etc. I only listed 3 APIs here, but we actually have dozens of them. So the main benefit I get out of using environments in other clients (Postman, Insomnia, etc.) is for different collections to share the same env variables, and being able to switch between environments with a single click. If my understanding is correct, the only way to do this in Bruno would be to create a single, huge collection for our whole project, and nest all our APIs inside it by creating a folder for each of them. But then, that would require having folder-level variables as well, so we can reuse variables across different methods (e.g.: same API endpoint). Ultimately, I think this is the reason why most popular clients have structured things that way. Otherwise you're very limited when it comes to automation, and you have to repeat variables in lots of places. Just my 2 cents, in case it makes you reconsider the feature! ;-) |
@victor-marino Definitely considering to support Global Environments at the app level. I'd like to understand your structure a bit more. payment-service
|-- dev-env
|--payment-config
|-- GET
|-- PUT
|-- DELETE\
|-- staging-env
|--payment-config
|-- GET
|-- PUT
|-- DEL Can you elaborate why your structure duplicates the payment config requests. Is it because the data that is being used while you test each environment is different ?
Can you talk about the project a bit more (if it is possible)? Also, in your directory structure - you have Hope you don't mind sharing some more details. It'll help me come up with a solution that is comprehensive. |
Sure, happy to elaborate! Maybe my diagram above was a bit confusing, as I was trying to show the env dependencies, not how I actually structure my collections in Postman. At my job, we develop multiple APIs that we expose in a common platform for customers to use. As a result, the structure of all our APIs is something like:
That means all our APIs share the same base path, OAuth2 path, credentials, etc. per environment. So in Postman I just have one collection per API, like this:
In each collection, the base path, OAuth path, credentials, etc. are all configured as env variables. And because environments are shared across collections, I only have to set them (and maintain them) once, and not once per API.
No, I've never used any sharing or paid features. We typically test these things individually, which means each of us may have their own workflow. However, I'm aware most devs at my workplace use the same kind of structure that I use when it comes to collections and environments, which makes sense given our platform structure. When somebody needs a collection for one of our APIs, we'll will typically export it in Postman (json) format and just send it over teams/email/etc.
No sorry, I was just referring to the structure of our platform (with a root base path for the root domain of our APIs). Sorry for the confusion. In the end, the key point here is that typically:
As a result, we need the ability for multiple collections to share the same environments, which is typically achieved by grouping them in workspaces in other apps. Otherwise we'd need to duplicate all our environments inside each collection, which would defeat their purpose altogether. Hope that's a bit clearer. |
@helloanoop We hope you can consider global environments. It's the only thing Bruno is missing. |
@AlanSandovalDev Will definitely support this as soon as we can. |
This issue seems quite related with #292 |
Hi @victor-marino, I'm just some rando, trying to understand your use-case better...
I think @helloanoop was asking why your structure was using folders to separate environments, instead of something like this:
...with the differences between
So the |
Hi there. While migrating postman collections and environments to bruno I stumbled across the "shared / global environments" topic. Simply create one directory which holds the environment files and use softlinks for the "environment" directories of the collections, pointing to that shared environment directory. My folder structure is: .
├── connectivity-service
│ ├── Test Connection.bru
│ ├── bruno.json
│ └── environments -> ../shared-environments
├── ditto
│ ├── Who am I-.bru
│ ├── bruno.json
│ └── environments -> ../shared-environments
├── exploration
│ ├── Search via POST.bru
│ ├── bruno.json
│ ├── collection.bru
│ └── environments -> ../shared-environments
├── shared-environments
│ ├── dev.bru
│ ├── prod.bru
│ ├── qa.bru
│ └── IDEA.bru
└── wot
├── Get Thing.bru
├── bruno.json
└── environments -> ../shared-environments When I create a new bruno collection, I simply create the softlink to the cd wot
ln -s ../shared-environments environments This softlink can even be committed to a Git repository - and at least on UNIX systems works out of the box. With that, I am able to use "shared environments" across all my collections. |
Hi, i tried to do the same things than @thjaeckle, Have you an idea, i execute the command : ln -s ../global-environnements environments in the directory Evenement |
I having the same problem. To stay true to your manifesto this need can be framed differently. More than a global Environment, the issue is more not to be able to have a Shared Environment. When you have a micro-service architecture, I want to have collection for each of my services, but I also want be able to run authentication collection once, set my TOKEN in a Shared Environment, and just have those other collections reuse that TOKEN. I hope it give more insights or another light to the problem. |
its a little hacky but,
|
This is a long running story... |
I agree too, Bruno is awesome but I think it must have global and collection editable variables such us environment variables. In my case, to use collection vars I have to setup pre-request vars, also these variables can not be secrets, so I have to use .env files or delete/ignore them to commit the collection to a repository. |
+1 |
Only one thing stopping me from migrating to Bruno - global variables absence :( |
I agree, I generally use one collection per api, but I can have several api on the same environment. In my case one oauth2 server and api servers. it's a pain to have to copy every environment. |
Same for me, this is a really important feature to completely migrate to bruno :) What es even more important is, that there is a possibility to do something like setGlobalEnv(...) for getting auth tokens in one collection and use this token in other collections that belong to own microservices (and therefore own repositories). What i will try to avoid is sharing this temp auth variables over an environment, what e.g. results maybe in changes on file system and therefore in git changes. |
The more i think about it, i come to the point that global variables and global environments are two separate things. This ticket #1509 was closed as duplicate, but maybe it is just another feature and maybe global variables are easier to solve, because they life not on file system but more a like in memory of the bruno runtime :) |
We are trying to migrate from Postman to Bruno. Are global variables still not supported? |
Global variables are very crucial for our workflow. Like we take Auth Token which are common for many collections BUT i unnecessarily have to create duplicates which creates redundancy and not practical to manage 50+ collection in my case. Can we please have global variables. As bruno consider collection as first class citizen, multiple tabs are not not working when we switch between collection. |
We are currently considering migrating from Postman to Bruno in the company. Even though we find the approach of having enviornments at collection level very elegant in some cases, it would sometimes be better if there were also global ones. It would be good if, for example, you could simply select between global and local enviornments in the dropdown. |
Thanks for the feature, it's good if people wanted it @helloanoop but The manifesto would need to be updated: https://docs.usebruno.com/introduction/manifesto
|
Whre is this "Global Environments" option? I'm on v1.35.0 and don't see what you've posted in the screenshot above. |
The design changed a little. It's now just the Globe-Button left to the normal environment selector. |
Environment object should be a separate entity by itself and not be stored inside a collection.
Currently we are not able to share environments across collections due to this
The text was updated successfully, but these errors were encountered: