Skip to content

Commit

Permalink
Fix env var examples and rewrite a bit to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
255kb committed Jun 7, 2024
1 parent fd3b4d9 commit a444903
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions content/docs/latest/templating/mockoon-variables-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ By default, only environment variables with the `MOCKOON_` prefix are available.
**Examples**

```handlebars
{{setVar 'varname' 'value'}}
{{getEnvVar 'VARIABLE_NAME' 'default value'}}
{{getEnvVar 'VARIABLE_NAME'}}
{{getEnvVar 'MOCKOON_VARIABLE_NAME' 'default value'}}
{{getEnvVar 'MOCKOON_VARIABLE_NAME'}}
{{getEnvVar (body 'property')}}
```
3 changes: 1 addition & 2 deletions content/docs/latest/variables/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ Environment variables are accessible [everywhere templating helpers are supporte

## Default prefix

By default, only the environment variables prefixed with `MOCKOON_` are available, for example, `MOCKOON_MY_VARIABLE`. You can access the variable in your templates using the `getEnvVar` helper with or without the prefix:
By default, only the environment variables prefixed with `MOCKOON_` are available, for example, `MOCKOON_MY_VARIABLE`. You can access the variable in your templates using the `getEnvVar` helper:

```handlebars
{{getEnvVar 'MOCKOON_MY_VARIABLE'}}
{{getEnvVar 'MY_VARIABLE'}}
```

> 📘 [Helper documentation](docs:templating/mockoon-variables-helpers#getenvvar).
Expand Down
3 changes: 1 addition & 2 deletions content/tutorials/use-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ They are available in all your environments, in the desktop application, or when

## 1. Access environment variables

To access an environment variable in your templates, use the `getEnvVar` helper. By default, only the environment **variables prefixed with `MOCKOON_`** are available. You can access the variable in your templates using the `getEnvVar` helper with or without the prefix. If you omit the prefix, the helper will automatically add it:
To access an environment variable in your templates, use the `getEnvVar` helper. By default, only the environment **variables prefixed with `MOCKOON_`** are available. You can access the variable in your templates using the `getEnvVar` helper. If you omit the prefix, the helper will automatically add it:

```handlebars
{{getEnvVar 'MOCKOON_MY_VARIABLE'}}
{{getEnvVar 'MY_VARIABLE'}}
```

> 📘 Head over to the [environment variables documentation](/docs/latest/variables/environment-variables/) where you will find more examples.
Expand Down

0 comments on commit a444903

Please sign in to comment.