Environments and {{variables}}
Write {{name}} anywhere in a request body, a metadata value or the server address. When you send, istek replaces it with the value of the variable called name. Save an environment and its variables are saved with it, so loading production swaps the address, the TLS settings, the metadata and every variable at once.
Updated
Add a variable
- Click the environments button in the toolbar, then Variables….
- Click +, type a name such as
token, and its value. - Click the lock to keep the value in the macOS Keychain instead of the workspace file.
- Use it:
Bearer {{token}}in anauthorizationheader, or{"tenant": "{{tenant}}"}in the body.
Switch environments
Set up staging, then save it from the environments popover. Change the address and variables for production and save that too. Loading either one restores its address, TLS settings, metadata and variables together; every request that uses {{host}} or {{token}} follows without being edited.
How substitution works
- It is plain text:
"id": {{id}}sends a number and"id": "{{id}}"a string, so you choose the JSON type with the quotes. - Names start with a letter or
_and may contain letters, digits,_,.and-, such asapi.hostortenant-id. - A value is inserted once and never expanded again, so a value containing
{{…}}is sent as written. - Only enabled variables count. When two share a name, the one higher in the list wins.
- History keeps the request as you wrote it, placeholders included, so replaying it uses the environment loaded now.
When a variable is missing
If a placeholder has no enabled variable, istek does not send the request and names the missing placeholder instead. Sending a literal {{token}} to a server only produces a confusing unauthenticated. In a client or bidirectional stream, the message is held back and the stream stays open, so you can add the variable and send again.
Copy as grpcurl
Copy as grpcurl fills in every variable so the command runs as pasted, except secret ones, which are copied as <REDACTED> in the same way as secret metadata.