Skip to content

Conversation

@harvzor
Copy link

@harvzor harvzor commented Jul 10, 2025

Issue

When trying to add environment variables, it's difficult to figure out where the settings should go based on the readme.

I attempted using the launchSettings.json but I think it's not read from there. It appears to only be read from your User Settings or Workspace Settings.

Solution

Update the readme to be explicit about where settings are read from.

Further more, be more explicit that environment variables should probably be stored in the Workspace Settings.

Thanks!

@telmotrooper
Copy link

telmotrooper commented Sep 5, 2025

Edit: I just noticed your commit updating the documentation, so you can ignore my comment. 😅️

It works if you set them in .vscode/settings.json, like so:

"rest-client.environmentVariables": {
  "local": {
    "api": "http://localhost:8080"
  }
}

Then you can use F1 > Rest Client: Switch Environment to select the environment.

With that you can just reference your variables in your request definition as usual:

POST {{api}}/auth/login
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "hello_world"
}

Though I'd rather be able to define these in a separate file altogether.

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.

2 participants