Documentation
¶
Overview ¶
Package dashboard mounts the nexus introspection surface under /__nexus. Ships a Vue dashboard (embedded from ui/dist), a JSON registry listing, and a WebSocket event stream.
Index ¶
Constants ¶
const Prefix = "/__nexus"
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
func Mount(e *gin.Engine, reg *registry.Registry, bus *trace.Bus, sched *cron.Scheduler, rl ratelimit.Store, ms metrics.Store, cfg Config)
Mount attaches:
GET /__nexus/config -> Config JSON GET /__nexus/endpoints -> services + endpoints from the registry GET /__nexus/resources -> resource snapshots (health probed live) GET /__nexus/middlewares -> middleware metadata GET /__nexus/crons -> cron job snapshots (schedule, next/last run, history) POST /__nexus/crons/:name/trigger -> run a job immediately (manual tick) POST /__nexus/crons/:name/pause -> pause scheduled ticks (manual Trigger still works) POST /__nexus/crons/:name/resume -> resume scheduled ticks GET /__nexus/events -> WebSocket: backlog (since=N) then live trace events GET /__nexus/manifest -> live manifest JSON (admin-token gated) GET /__nexus/, /assets/* -> embedded Vue dashboard
The events endpoint is only mounted if bus != nil. The manifest endpoint is only mounted when BOTH cfg.Manifest != nil AND cfg.AdminToken != "" — fail-closed so a forgotten env var doesn't silently expose service/env/cron declarations to the public. The cron + rate-limit + metrics endpoints are always mounted — their stores just return empty lists when nothing has been registered.
Types ¶
type Config ¶
type Config struct {
Name string `json:"Name"`
Middleware []gin.HandlerFunc `json:"-"`
// Deployment is the unit name this binary boots as ("" = monolith).
// Surfaced over /__nexus/config so the dashboard can render the
// active deployment, and so peer services in a split deployment
// can introspect it via federation.
Deployment string `json:"Deployment,omitempty"`
// Version is the binary's release tag (defaults to "dev"). Used by
// generated cross-service clients to detect version skew.
Version string `json:"Version,omitempty"`
// Manifest is the closure dashboard.Mount calls on each request to
// GET /__nexus/manifest. Returning the same value print mode
// emits — typically `manifest.Build(app.manifestInputs())` — keeps
// runtime and build-time JSON byte-equivalent (modulo
// App.GeneratedAt, which is excluded from ManifestHash). When nil,
// the manifest endpoint is not mounted.
Manifest func() manifest.Manifest `json:"-"`
// AdminToken gates GET /__nexus/manifest with a Bearer-token check.
// Required for the endpoint to mount: empty token + non-nil
// Manifest closure → endpoint stays unmounted (fail-closed). The
// orchestration platform sets this via NEXUS_ADMIN_TOKEN at deploy
// time; for local dev set it explicitly when you want to read the
// runtime manifest.
//
// Compared in constant time against the request's
// `Authorization: Bearer <token>` header.
AdminToken string `json:"-"`
}
Config carries the dashboard's runtime knobs: the brand the client fetches at startup + any gin middleware that should guard the /__nexus surface (auth, permission, allowlist, etc.).