Chain Source

A chain source defines how a Chain gets its value. It populates the source field of a chain. There are multiple source types, and the type is specified using YAML's tag syntax.

Examples

See the Chain docs for more complete examples.

!request
recipe: login
trigger: !expire 12h
---
!command
command: ["echo", "-n", "hello"]
---
!env
variable: USERNAME
---
!file
path: ./username.txt
---
!prompt
message: Enter Password

Variants

VariantTypeDescription
!requestChainSource::RequestBody of the most recent response for a specific request recipe.
!commandChainSource::CommandStdout of the executed command
!envChainSource::EnvironmentValue of an envionrment variable, or empty string if undefined
!fileChainSource::FileContents of the file
!promptChainSource::PromptValue entered by the user

Request

Chain a value from the body of another response. This can reference either

FieldTypeDescriptionDefault
recipestringRecipe to load value fromRequired
triggerChainRequestTriggerWhen the upstream recipe should be executed, as opposed to loaded from memory!never
sectionChainRequestSectionThe section (header or body) of the request from which to chain a valueBody

Chain Request Trigger

This defines when a chained request should be triggered (i.e. when to execute a new request) versus when to use the most recent from history.

VariantTypeDescription
neverNoneNever trigger. The most recent response in history for the upstream recipe will always be used; error out if there is none
no_historyNoneTrigger only if there is no response in history for the upstream recipe
expireDurationTrigger if the most recent response for the upstream recipe is older than some duration, or there is none
alwaysNoneAlways execute the upstream request

Duration is specified as an integer followed by a unit (with no space). Supported units are:

  • s (seconds)
  • m (minutes)
  • h (hours)
  • d (days)

Examples

!request
recipe: login
trigger: !never # This is the default, so the same as omitting
---
!request
recipe: login
trigger: !no_history
---
!request
recipe: login
trigger: !expire 12h
---
!request
recipe: login
trigger: !expire 30s
---
!request
recipe: login
trigger: !always

Chain Request Section

This defines which section of the response (headers or body) should be used to load the value from.

VariantTypeDescription
bodyNoneThe body of the response
headerstringA specific header from the response. If the header appears multiple times in the response, only the first value will be used

Examples

!request
recipe: login
section: !header Token # This will take the value of the 'Token' header

Command

Execute a command and use its stdout as the rendered value.

FieldTypeDescriptionDefault
commandTemplate[]Command to execute, in the format [program, ...arguments]Required
stdinTemplateStandard input which will be piped into the commandNone

Environment Variable

Load a value from an environment variable.

FieldTypeDescriptionDefault
variableTemplateVariable to loadRequired

File

Read a file and use its contents as the rendered value.

FieldTypeDescriptionDefault
pathTemplatePath of the file to load (relative to current directory)Required

Prompt

Prompt the user for input to use as the rendered value.

FieldTypeDescriptionDefault
messageTemplateDescriptive prompt for the userChain ID
defaultTemplateValue to pre-populated the prompt textbox. Note: Dur to a library limitation, not supported on chains with sensitive: true in the CLInull