Skip to content

Commit e80c222

Browse files
committed
improve docs for variables and secrets
1 parent 293b61a commit e80c222

File tree

1 file changed

+17
-19
lines changed
  • docs/core_concepts/2_variables_and_secrets

1 file changed

+17
-19
lines changed

docs/core_concepts/2_variables_and_secrets/index.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,26 @@ Reserved variables are passed to the job as environment variables. For example,
6060
There are 2 main ways variables are used withing scripts:
6161

6262
1. passing variables as parameters to scripts
63-
2. fetching them from within a script by using the wmill client in the respective language
64-
65-
3. Variables can be easily passed as parameters of the script, using the UI based variable picker. Underneath, the variable is passed as a string of the form: `$var:<variable_path>` and replaced by the worker at time of execution of the script by fetching the value with the job's permissions. So the job will fail if the job's permissions inherited from the caller do not allow it to access the variable. This is the same mechanism used for resource, but they use `$res:` instead of `$var:`.
63+
Variables can be easily passed as parameters of the script, using the UI based variable picker. Underneath, the variable is passed as a string of the form: `$var:<variable_path>` and replaced by the worker at time of execution of the script by fetching the value with the job's permissions. So the job will fail if the job's permissions inherited from the caller do not allow it to access the variable. This is the same mechanism used for resource, but they use `$res:` instead of `$var:`.
6664

67-
4. Within a script, one can the wmill client of their respective language. For instance, for the variable `u/user/foo`:
65+
2. fetching them from within a script by using the wmill client in the respective language
6866

69-
```typescript
70-
wmill.getVariable('u/user/foo');
71-
```
67+
```typescript
68+
wmill.getVariable('u/user/foo');
69+
```
7270

73-
```python
74-
wmill.get_variable("u/user/foo")
75-
```
71+
```python
72+
wmill.get_variable("u/user/foo")
73+
```
7674

77-
```go
78-
wmill.GetVariable("u/user/foo")
79-
```
75+
```go
76+
wmill.GetVariable("u/user/foo")
77+
```
8078

81-
```bash
82-
curl -s -H "Authorization: Bearer $WM_TOKEN" \
83-
"$BASE_INTERNAL_URL/api/w/$WM_WORKSPACE/variables/get/u/user/foo" \
84-
| jq -r .value
85-
```
79+
```bash
80+
curl -s -H "Authorization: Bearer $WM_TOKEN" \
81+
"$BASE_INTERNAL_URL/api/w/$WM_WORKSPACE/variables/get/u/user/foo" \
82+
| jq -r .value
83+
```
8684

87-
The last example is in bash and showcase well how it works under the hood: It fetches the secret from the API using the job's permissions through the ephemeral token passed as environment variable to the job.
85+
The last example is in bash and showcase well how it works under the hood: It fetches the secret from the API using the job's permissions through the ephemeral token passed as environment variable to the job.

0 commit comments

Comments
 (0)