Documentation
¶
Overview ¶
Package exec contains the exec node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecConfig ¶
type ExecConfig struct {
// Command is the base command line to run through the system shell.
Command string `json:"command"`
// AddPay names a payload/metadata property whose value is appended
// VERBATIM to the command line (empty = nothing appended). This is
// Node-RED parity — the shell expands it, so an addpay fed by
// untrusted input (e.g. an httpTrigger body) can inject shell
// syntax. Only enable exec (AllowExec) on trusted flows.
AddPay string `json:"addpay"`
// Append holds extra arguments appended after the addpay value.
Append string `json:"append"`
// Timer is a kill timeout in seconds (0 = no timeout).
Timer float64 `json:"timer"`
}
ExecConfig holds configuration for the exec node — the Node-RED `exec` equivalent (buffered mode only).
type ExecNode ¶
ExecNode runs a system command and returns stdout/stderr/rc.
SECURITY: arbitrary command execution is gated behind WorkflowEngine.ExecAllowed() — the node fails with "exec disabled" unless the flag is set (env GOFLOW_ALLOW_EXEC=1 wires it in main). The addpay value is concatenated into the shell command line exactly like Node-RED does, so even an enabled exec node is only as safe as the messages routed into it.
func NewExecNode ¶
func NewExecNode(node nodestore.NodeInterface, config *ExecConfig, host nodebase.NodeHost) *ExecNode
NewExecNode creates a new exec node
func (*ExecNode) Execute ¶
func (n *ExecNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute builds the full command line (command + addpay-resolved value + append), runs it buffered through the shell and returns stdout as Data with rc/stderr in Metadata.
func (*ExecNode) SelectPorts ¶
func (n *ExecNode) SelectPorts(input, output nodestore.MessageInterface) []string
SelectPorts routes rc 0 to output_1 (stdout); a non-zero exit goes to output_3 (Node-RED's "return code" port) carrying stderr + rc.