Environments

How to use environments in Headrest

Image of sections of Headrest involved in using environments

Environments are a way to store different values for the same variable. This is useful when you need to use different values for a variable depending on the environment you are in.

For example, you may want to use a different API URL for your development environment than you do for your production environment.

The variable values used are those set on the currently selected environment.

Creating an environment

By default, one environment is created automatically the first time you open Headrest. This environment is called Untitled.

To create another environment, click the current environment and select Manage environments. This will open the Environments modal.

Screenshot of opening the environments modal

Click the New environment button to create a new environment and give it a unique name.

Renaming environments

An environment can be renamed by double-clicking it in the Manage environments modal, typing in a new name and pressing Enter (or clicking the Save button).

Current environment

The current environment is the environment that is selected in the environments dropdown. To select another environment, click it and select another value from the dropdown.

Variable values are taken from the currently selected environment. Also, setting a variable dynamically, will set that value on the currently selected environment.

This means that variables will have different values depending on the currently selected environment. This helps with creating and chaining requests without having to manually change variable values from a development environment to a production one.

Deleting environments

To delete an environment, go to the Manage environments modal again and click the delete icon next to the environment you need to delete.

Deleting an environment will delete all variable values set on it. This includes both the default values and any values set dynamically.

Not using environments

No everyone needs to use environments. If you don't need to use them, you can leave the default environment selected. If you want, you can also rename it to something more meaningful, to match your use case.

Environments and Variables

Environments work best when paired with variables. Read about using variables in Headrest.