This is documentation for the next version of Agent. For the latest stable release, go to the latest version.
Function calls
Function calls is one more River feature that lets users build richer expressions.
Functions take zero or more arguments as their input and always return a single value as their output. Functions cannot be constructed by users, but can be either called from River’s standard library, or when exported by a component.
In case a function fails, the expression will not be evaluated and an error will be reported.
Standard library functions
River contains a standard library of useful functions. Some enable interaction with the host system (e.g. reading from an environment variable), or allow for more complex expressions (e.g. concatenating arrays or decoding JSON strings into objects).
env("HOME")
json_decode(local.file.cfg.content)["namespace"]