Variable interpolation
When configuring a library function's parameters you can use dynamic data from the context or received events.
To do so, include a variable interpolation expression in a text field. A variable interpolation expression has the form: {SOURCE[PATH]}
.
SOURCE
may be one of:
event
,env
, andparams
.
event
references the received event. env
references the applications variables. params
references a library function's parameters.
PATH
is some expression that references a part of the SOURCE
, e.g. .foo
.
A complete variable interpolation expression can thus look like {event.foo}
. This expression would expand to the foo
property of the received event. One can also include an expression among other text, e.g. Request took {event.request.duration}s
.
If an expression can't be resolved, the expression will be included as is. E.g. say that the event has no bar
property. Then would the expression {event.bar}
not be replaced.
env
is always available.
params
is only available within library functions.
event
is only in a handler context, i.e. if a parameter with an event
expression is used in the setup context, the resolution would fail as there is no event, and the expression would be used as is.
Updated about 2 years ago