server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server implements the nerdui HTTP API and serves the web UI.

Index

Constants

View Source
const APIPrefix = "/api/"

APIPrefix is the path prefix of API routes subject to the default-deny check.

View Source
const ContentSecurityPolicy = "default-src 'self'; script-src 'self'; " +
	"style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; " +
	"connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'; object-src 'none'"

ContentSecurityPolicy restricts the UI to its own origin. Inline styles are allowed because Mantine sets style attributes; scripts are only loaded from the embedded bundle.

Variables

This section is empty.

Functions

func New

func New(cfg Config) http.Handler

New returns the root HTTP handler. It panics if an API route does not declare its authorization (programming error caught by tests).

Types

type Config

type Config struct {
	// Backup is what an application backup contains (#89); nil disables backups.
	Backup *backup.Source
	// Schedules are the scheduled jobs (#82); nil disables them.
	Schedules *scheduler.Service
	// Variables are the stack variables (#35); nil disables them.
	Variables *variables.Service
	// VolumeBackups back up and restore volumes (#59); nil disables them.
	VolumeBackups *volbackup.Service
	// Templates are the stack templates (#33, #34); nil disables them.
	Templates *templates.Service
	// HostMetrics samples the host (#64); nil disables host metrics.
	HostMetrics *hostmetrics.Sampler
	// BasePath is the path prefix nerdui is served under, e.g. /nerdui, or "" (#222).
	BasePath string
	// Auth provides sessions and the authentication endpoints (required).
	Auth *auth.Service
	// Authorizer decides per-action access; defaults to authz.AdminOnly (ADR-0009).
	Authorizer authz.Authorizer
	// Environments are the managed containerd hosts (required).
	Environments *environment.Registry
	// UI is the compiled frontend. When nil, the UI is not served.
	UI fs.FS
	// Jobs runs long operations (#126); when nil, a manager is created (tests).
	Jobs *jobs.Manager
	// EventHistory serves recorded events (#65); nil when recording is disabled.
	EventHistory api.EventHistory
	// DisableExec turns off the web terminal (#15).
	DisableExec bool
	// Settings stores per-environment settings (#176); nil disables them.
	Settings api.Settings
	// Stacks finds compose stacks (#24); nil disables them.
	Stacks *stacks.Service
	// GitStacks deploys stacks from Git repositories (#37); nil disables them.
	GitStacks *gitstacks.Service
	// GitAuto handles webhooks of Git stacks (#38); nil answers 501.
	GitAuto *gitstacks.Auto
	// Webhooks are the incoming webhooks (#85, #91); nil answers 501.
	Webhooks *webhooks.Service
	// ImageUpdates checks images for newer registry digests (#53); nil disables it.
	ImageUpdates api.ImageUpdates
	// AutoUpdates is the log of automatic updates (#54); nil disables it.
	AutoUpdates api.AutoUpdates
	// TrustedProxies are reverse proxies whose X-Forwarded-* headers are honored (#112).
	TrustedProxies []netip.Prefix
	// ACME serves certificates from an ACME CA (#113); nil when not configured.
	ACME *tlsutil.ACME
	// Notifications stores notification channels and Notifier sends through them (#86); nil
	// disables them.
	Notifications api.NotificationStore
	Notifier      *notify.Service
	// Audit records and serves the audit log (#79); nil disables it.
	Audit  *audit.Recorder
	Logger *slog.Logger
}

Config configures the HTTP server.

type VersionResponse

type VersionResponse struct {
	Nerdui  version.Info      `json:"nerdui"`
	Runtime *runtime.Versions `json:"runtime,omitempty"`
	Error   string            `json:"error,omitempty"`
	// ACME describes ACME certificates when configured (#113).
	ACME *tlsutil.ACMEStatus `json:"acme,omitempty"`
}

VersionResponse is returned by GET /api/v1/version. Keep in sync with api/openapi.yaml. Build information (including the AGPL source link) is public; runtime details are only returned to callers allowed to perform system:read.

Jump to

Keyboard shortcuts

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