server

package
v0.3.0-rc13 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: BSD-3-Clause Imports: 63 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MountAPIForCodegen added in v0.2.0

func MountAPIForCodegen(mux *http.ServeMux) huma.API

MountAPIForCodegen is the exported entry the openapi dump tool uses to introspect the spec without instantiating Deps + auth. Mirrors weft-webui's pattern.

Types

type GitSecurityConfig added in v0.4.0

type GitSecurityConfig struct {
	// HostBlocklist is a set of hostnames that always fail validation.
	HostBlocklist []string
	// AllowPlainHTTP opts in to "http://" remotes ; default false.
	AllowPlainHTTP bool
}

GitSecurityConfig governs which git remotes the clone/pull/push handlers will dial. Defaults reject loopback, RFC1918 and the AWS metadata IP ; HostBlocklist extends the deny list with operator- specified DNS names.

type Options

type Options struct {
	// Logger is the slog logger. Required.
	Logger *slog.Logger
	// Static is the SPA bundle FS (typically the embedded dist/).
	Static fs.FS
	// Projects backs project file IO.
	Projects project.Store
	// Compiler orchestrates microVM compile jobs.
	Compiler *compile.Service
	// Auth validates OIDC bearers. nil = dev mode (auth disabled,
	// every request gets a synthetic identity).
	Auth auth.Verifier
	// Config bundles security-sensitive runtime knobs (WS origin
	// allowlist, host-pty fallback gate, git host blocklist). Zero
	// value = safe production defaults except in dev mode (Auth=nil)
	// where the missing-config path is permissive on purpose.
	Config SecurityConfig
	// Mailer delivers @-mention + new-comment notifications. nil =
	// noop (no SMTP configured). NewSender returns a NoopSender for
	// an empty SMTPHost so callers can always set this field.
	Mailer email.Sender
}

Options bundles everything the server needs to boot.

type SecurityConfig added in v0.4.0

type SecurityConfig struct {
	// AllowOrigin restricts the set of HTTP Origin values accepted on
	// websocket upgrades. "*" or empty = no enforcement (the
	// reverse-proxy layer is expected to validate). Comma-separated
	// list otherwise ; each entry is a coder/websocket OriginPattern
	// (host[:port], wildcards allowed).
	AllowOrigin string
	// AllowHostPty toggles the dev-mode fallback in handleShell that
	// spawns a pty on the loom-server host when the NATS exec relay
	// fails. Default false : in production a relay failure surfaces
	// to chat and the session ends. Dev mode (Auth=nil) ignores this
	// gate and keeps the fallback for local iteration.
	AllowHostPty bool
	// Git contains git remote SSRF guards.
	Git GitSecurityConfig
}

SecurityConfig groups runtime security knobs surfaced to the server (kept distinct from internal/config.Config so the cmd/ binary can translate operator HCL into this struct without dragging the HCL types into the server package).

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP handler tree, built once at startup.

func New

func New(opts Options) (*Server, error)

New wires the routes ; returns an http.Handler ready to mount on a net/http listener.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler. Delegates to the inner mux ; the auth middleware lives inside the route registrations so we can keep healthz unauthenticated.

func (*Server) Shutdown added in v0.4.0

func (s *Server) Shutdown(ctx context.Context)

Shutdown tears down the server's owned resources. main is responsible for the http.Server shutdown ; Shutdown handles the workspace VMs + embedded broker.

Jump to

Keyboard shortcuts

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