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

feat(#303): Default Environment #1032

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

n00o
Copy link
Contributor

@n00o n00o commented Nov 23, 2023

Add environment to the presets tab which will set the default environment on opening a collection. Show default environment inside of environment selector. Also add cli support for default environments.

Description

This is to fix #303 by adding the property called environment inside of Collection > Presets. The collection descriptor file, bruno.json will now have the preset structure of:

{
  "presets": {
     "defaultUrl": "",
     "defaultRequestType": "",
     "environment": null
  }
}

The preset environment will only change the environment under these conditions:

  • The collection is first being opened
  • The collection is being opened again and the current session had the environment set to No Environment (if its something else then it won't set the environment)

In the future we can rely on something like lastEnvironment to override the preset environment if people set it in their preferences.

Default_Environment.mp4

The environment selector now has a helpful indicator showing what the preset environment is by the yellow (Default) value at the end of it. Any old collections that don't have a preset environment or the environment can't be found in the current list of environments will default to No Environment insuring that nothing breaks.

Some behavior that I need some guidance on @helloanoop, would be the formatting of (Default) indicator and whether to have it display next to No Environment if an environment preset is defined but not found. Currently I am setting it to No Environment in the environment selector and showing an error message on collection open when environment can't be found.

Now Bruno cli will try to look for the new environment preset value and set it as the environment if none is given.
Default_Environment_cli

I think this is a very helpful QOL change that will make opening and testing APIs a quick and easy process.

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Add environment to the presets tab which will set the default environment on opening a collection. Show default environment inside of environment selector. Also add cli support for default environments.
@n00o n00o force-pushed the feature/Default_Environment branch from 861d316 to 50b5640 Compare November 23, 2023 06:42
@Napam
Copy link

Napam commented Jan 30, 2024

I personally would like something like this, is there any plans to incorporate such functionality? @helloanoop

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

Successfully merging this pull request may close these issues.

[Feature] Default environment
2 participants