Skip to content

Environments

Environment configuration is where implementations diverge most significantly. Three major formats exist.

VS Code REST Client (settings.json)
{
  "rest-client.environmentVariables": {
    "$shared": { "version": "v1" },
    "development": { "host": "localhost:3000" },
    "production": { "host": "api.example.com" }
  }
}
JetBrains (http-client.env.json)
{
  "development": {
    "host": "localhost:8080",
    "username": "dev-user"
  },
  "production": {
    "host": "api.example.com",
    "username": "prod-user"
  }
}
httpyac (.env)
# .env
HOST=localhost:3000

# .env.development
HOST=localhost:8080

# Also supports http-client.env.json
# and httpyac.config.js

Environments are defined in VS Code's settings.json under rest-client.environmentVariables:

{
"rest-client.environmentVariables": {
"$shared": {
"version": "v1",
"prodToken": "foo"
},
"development": {
"host": "localhost:3000",
"token": "{{$shared prodToken}}"
},
"production": {
"host": "api.example.com",
"token": "real-prod-token"
}
}
}

The special $shared environment provides variables available in all environments, overridable by specific environment values. Users switch environments via the VS Code status bar or Ctrl+Alt+E.

JetBrains uses a standalone JSON file named http-client.env.json (intended for version control) paired with http-client.private.env.json (for secrets, excluded from VCS):

{
"development": {
"host": "localhost:8080",
"username": "dev-user"
},
"production": {
"host": "api.example.com",
"username": "prod-user"
}
}

Private file values override public file values for the same variable names. SSL configuration is also embedded in the private env file (see Section 16: SSL & Certificates).

JetBrains supports JSONPath-based nested variable access since 2024.2.

httpyac supports all of the above plus its own formats:

  • .env files (dotenv format) — .env for globals, .env.local or local.env for environment-specific
  • http-client.env.json — full JetBrains compatibility
  • httpyac.config.js (or .httpyac.js, .httpyac.json) — JavaScript/JSON config with $shared, $default, and named environments

Searched in: current directory, project root, env subdirectory, and HTTPYAC_ENV path.

httpyac allows multiple environments to be active simultaneously (--env dev --env shared).

Visual Studio 2022: http-client.env.json + .user

Section titled “Visual Studio 2022: http-client.env.json + .user”

Visual Studio 2022 adopted the JetBrains http-client.env.json format with a Microsoft-specific extension: http-client.env.json.user (excluded from source control). It also supports $shared (since v17.12).

Uniquely, VS 2022 adds secrets providers within environment files:

{
"development": {
"secret_key": {
"provider": "AzureKeyVault",
"secretName": "my-secret",
"resourceId": "/subscriptions/.../vaults/my-vault"
}
}
}

Supported providers: ASP.NET Core User Secrets, Azure Key Vault, and DPAPI encryption (Windows).

kulala.nvim supports both http-client.env.json (JetBrains-style) and .env files, aiming for full IntelliJ compatibility.

Feature VS CodeJetBrainshttpyacVS 2022kulala
Inline variable definition (@var = value)
Variable substitution ({{variableName}})
Percent-encoding substitution ({{%var}}) URL-encodes the variable value. Unique to VS Code REST Client.
Lazy variables (@var := value) Evaluated at execution time rather than parse time.
Named request response chaining Syntax differs: VS Code uses dot-path ({{name.response.body.$.path}}), JetBrains uses script-based global variables, httpyac uses @ref.
Environments in settings.json
http-client.env.json
http-client.private.env.json
http-client.env.json.user Microsoft-specific override file.
.env dotenv files VS Code REST Client and VS 2022 support via {{$dotenv NAME}} accessor. httpyac and kulala parse .env files natively.
JS/JSON config file httpyac.config.js or .httpyac.js
$shared environment
Secrets providers (Azure Key Vault, etc.) ASP.NET Core User Secrets, Azure Key Vault, DPAPI.