dashboard

package
v0.0.0-...-7592c80 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package dashboard exposes the BaQueue dashboard as a standard HTTP handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(driver baqueue.Driver, options ...Option) http.Handler

New returns a handler usable with net/http, Gin's WrapH or Echo's WrapHandler. The caller owns the driver's connection and lifecycle. New starts no goroutines; live-feed goroutines run only while clients are connected. Configure WithAuth before exposing this administrative handler outside a trusted network.

Types

type Option

type Option func(*config)

Option configures the dashboard handler.

func WithAuth

func WithAuth(middleware func(http.Handler) http.Handler) Option

WithAuth wraps all routes, including assets and WebSocket handshakes. The middleware must preserve http.Hijacker support for WebSocket requests.

func WithContext

func WithContext(ctx context.Context) Option

WithContext binds live feeds to ctx. Cancellation closes WebSockets, stops the overview broadcaster, and rejects new WebSocket handshakes. REST requests retain their own contexts so http.Server.Shutdown can drain them gracefully. The caller still owns the driver's lifecycle and must wait for handlers to return before disconnecting it.

func WithOriginPatterns

func WithOriginPatterns(patterns ...string) Option

WithOriginPatterns permits additional WebSocket origin hosts using coder/websocket's host-pattern syntax. By default only the request host is accepted. Never use "*" for a dashboard authenticated with cookies.

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix mounts every route under prefix (for example, "/baqueue"). Register the returned handler at prefix and prefix+"/" without StripPrefix. Alternatively, use http.StripPrefix with New(driver) and no WithPrefix.

func WithRefreshIntervals

func WithRefreshIntervals(overview, jobs time.Duration) Option

WithRefreshIntervals overrides the default 2s overview and 1.5s jobs feeds.

Jump to

Keyboard shortcuts

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