Documentation
¶
Overview ¶
Package api serves the admin REST API and the editor's event websocket.
Index ¶
Constants ¶
const ( PermFlowsRead = "flows.read" PermFlowsWrite = "flows.write" PermStatusRead = "status.read" PermNodesRead = "nodes.read" PermSettings = "settings.read" PermInject = "inject.write" )
Permissions the API checks. Mirrors Node-RED's granular scheme so a read-only dashboard token cannot deploy a flow.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeployResult ¶
type DeployResult struct {
Rev string `json:"rev"`
Failures []runtime.StartError `json:"-"`
Warnings []string `json:"warnings,omitempty"`
}
DeployResult reports what a deploy did.
type Deps ¶
type Deps struct {
Config config.Config
Registry *node.Registry
Flows *store.FlowStore
Credentials *store.CredentialStore
Logger *slog.Logger
// Runtime returns the currently running runtime. It is a function rather
// than a value because a deploy replaces the whole runtime, and every
// handler needs the live one rather than the one that existed at startup.
Runtime func() *runtime.Runtime
// Deploy swaps in a new flow set. It owns stopping the old runtime,
// persisting, and starting the new one.
Deploy func(ctx context.Context, flows *engine.Flows, expectedRev string) (DeployResult, error)
// FlowRoutes holds the paths the flow's HTTP In nodes have claimed. It is
// consulted for anything the fixed routes below did not match, because a
// flow's routes change on every deploy and http.ServeMux cannot unregister
// a pattern.
FlowRoutes *flowhttp.Router
// Version identifies this build in /settings and the log.
Version string
}
Deps is everything the server needs from the rest of the process.