git

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package git is a ServerController that serves templates from a git repository via the installed `git` binary. JSON type: "git".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// Repo is the git repository URL or path. Required.
	Repo string `json:"repo,omitempty" arg:"--git-repo"`

	// Ref is the branch/tag/ref to track. Empty uses the remote default.
	Ref string `json:"ref,omitempty" arg:"--git-ref"`

	// Interval between polls. Default 15s.
	Interval xtemplate.Duration `json:"interval,omitempty" arg:"--git-interval"`

	// Path is the subdirectory inside the clone that holds templates. Default "templates".
	// Must be a relative path with no ".." segments (confined to the clone).
	Path string `json:"path,omitempty" arg:"-t,--template-dir,--templates-dir" default:"templates"`
}

Controller polls a remote (or local) git repo and reloads when the ref moves. JSON type: "git".

func (*Controller) Init

func (s *Controller) Init(_ context.Context, _ *slog.Logger) ([]xtemplate.Option, error)

Init validates config. Sticky is nil until the first successful Reload.

func (*Controller) Start

func (s *Controller) Start(server *xtemplate.Server) error

Start polls the remote and reloads on new commits. Cancelling server.Context() stops the poller. last-SHA advances only when Reload succeeds.

Directories

Path Synopsis
Package caddyfile registers the git controller Caddyfile parser.
Package caddyfile registers the git controller Caddyfile parser.

Jump to

Keyboard shortcuts

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