themehost

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package themehost validates and runs the prebuilt theme artifacts a site is served from.

Index

Constants

View Source
const MaxSize = 64 << 20

MaxSize is the largest a theme directory may be.

Variables

View Source
var ErrNotInstalled = errors.New("themehost: theme not installed")

ErrNotInstalled reports that no theme is installed under the name.

Functions

This section is empty.

Types

type Supervisor

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

Supervisor runs one theme server and keeps it running.

func NewSupervisor

func NewSupervisor(config SupervisorConfig) *Supervisor

NewSupervisor returns a supervisor for one theme.

func (*Supervisor) Group

func (s *Supervisor) Group() int

Group returns the process group the theme runs in, zero while it is down.

func (*Supervisor) Healthy

func (s *Supervisor) Healthy() bool

Healthy reports whether the theme is serving.

func (*Supervisor) Start

func (s *Supervisor) Start()

Start runs the theme until Stop is called.

func (*Supervisor) Stop

func (s *Supervisor) Stop()

Stop ends the theme and waits for its process group to go.

func (*Supervisor) Target

func (s *Supervisor) Target() string

Target returns the address the theme serves on, empty while it is down.

type SupervisorConfig

type SupervisorConfig struct {
	Theme        *Theme
	NodeBin      string
	APIAddr      string
	Logger       *slog.Logger
	ReadyTimeout time.Duration
	Backoff      time.Duration
	MaxBackoff   time.Duration
	MaxAttempts  int
	StopGrace    time.Duration
	StubDelay    time.Duration
}

SupervisorConfig is what a supervisor needs to run one theme.

type Theme

type Theme struct {
	Name    string
	Version string
	Kit     string
	Dir     string
	Entry   string
}

Theme is a validated theme directory.

func Load

func Load(themesDir, name string) (*Theme, error)

Load returns the theme installed under a name, or nothing when no theme is named.

Jump to

Keyboard shortcuts

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