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

Make it possible to retrieve the current environment name: bru.environment.name #2179

Closed
1 task done
MeTitus opened this issue Apr 26, 2024 · 5 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@MeTitus
Copy link

MeTitus commented Apr 26, 2024

I have checked the following:

  • I've searched existing issues and found nothing related to my issue.

Describe the feature you want to add

https://community.postman.com/t/extract-active-environment-name-within-script/1052/6

Mockups or Images of the feature

bru.environment.name

@MeTitus MeTitus added the enhancement New feature or request label Apr 26, 2024
@rafeanders
Copy link

bru.getEnvName()

Example in a script to do something different depending on environment:

switch (bru.getEnvName(this)) {
    case 'staging':
        do this;
        break;
    case 'production':
        do this other thing;
        break;
    default:
        console.log("Your not in any of those environments");
}

There is/was a bug with that however, involving bru.setEnvVar and I'm unsure if the fix has been merged yet.

@MeTitus
Copy link
Author

MeTitus commented Apr 29, 2024

I just tried it out and the bru.setEnvVar issue is still there.
Thanks for the help.

@Sirafe
Copy link

Sirafe commented Apr 29, 2024

It works again on 1.15.0 just tested.

@MeTitus
Copy link
Author

MeTitus commented Apr 29, 2024

@Sirafe It does indeed :)

@Sirafe
Copy link

Sirafe commented Apr 30, 2024

If this solves your request, could you close this request?

@MeTitus MeTitus closed this as completed Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants