Documentation
¶
Overview ¶
Package server exposes the CMS core over a JSON HTTP API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Users authkit.AdminStore
// Posts persists the content the CMS serves.
Posts post.Store
// Plugins maps a plugin id to its HTTP handler.
Plugins map[string]http.Handler
// PluginPublicPaths maps a plugin id to its session-exempt paths.
PluginPublicPaths map[string][]string
// Web serves the single-page app under the admin base path. Nil leaves the admin paths unhandled.
Web fs.FS
// SiteTitle names the public site in its chrome.
SiteTitle string
// TrustedProxies lists the CIDR ranges trusted to set X-Forwarded-For.
TrustedProxies []string
// Theme serves the public site while it is healthy. Nil leaves the built-in renderer serving.
Theme Theme
// Themes is the managed themes directory. Nil leaves the theme routes unhandled.
Themes Themes
// ThemeTimeout is how long a theme has to begin answering. Zero applies the default.
ThemeTimeout time.Duration
// Version is the application version reported at /api/version.
Version string
}
Config carries the stores and plugin surfaces the server serves.
type Theme ¶
type Theme interface {
// Healthy reports whether the theme is serving.
Healthy() bool
// Target returns the address the theme serves on.
Target() string
}
Theme is the running theme the public site is served through.
type Themes ¶ added in v0.2.0
type Themes interface {
// List returns the installed themes, marking the one that is active.
List(ctx context.Context) ([]themehost.Installed, error)
// Install unpacks the archive as the named theme.
Install(ctx context.Context, name string, archive io.ReaderAt, size int64) error
// Activate serves the public site through the named theme.
Activate(ctx context.Context, name string) error
// Deactivate returns the public site to the built-in renderer.
Deactivate(ctx context.Context) error
// Rollback returns the public site to the choice before the current one, naming it.
Rollback(ctx context.Context) (string, error)
// Previous returns the choice a rollback would return to, and whether one is offered.
Previous(ctx context.Context) (string, bool, error)
}
Themes is the managed themes directory the admin lists and installs into.
Click to show internal directories.
Click to hide internal directories.