Help us shape the future of Go! Take the 2026 Go Developer Survey

trigger

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package trigger is the HTTP interface that starts flow runs:

POST /flows/<flow>/run[?collection=<c>][&wait=<duration>]
GET  /runs/<id>
GET  /healthz

Every route but /healthz needs "Authorization: Bearer <token>". The token is checked before the path is looked at, so a caller without it learns nothing about which flows exist. An address that sends ten bad tokens in a minute is answered 429 until the minute ends.

The endpoint speaks plain HTTP, so the token crosses the network in the clear: keep it on loopback, or put a TLS-terminating proxy in front.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoToken = errors.New("triggers need a token")

ErrNoToken is returned by New when the token is empty: triggers without authentication are never offered.

Functions

func New

func New(o Options) (http.Handler, error)

New returns the trigger handler.

Types

type Options

type Options struct {
	Token   string
	Runs    *runs.Manager
	MaxWait time.Duration // longest ?wait= honoured (default 5m)
	Logger  *slog.Logger
	Now     func() time.Time // for the failure window (default time.Now)
}

Options configure the handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL