server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 20 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 {
	// 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
	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"`
}

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