sitetpl

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sitetpl expands the {{…}} placeholders a framework definition may use in env vars, setup steps, and commands, so the store can declare a per-site value (a base URL, a database name) without lerd knowing the framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(s string, ctx Ctx) string

Apply replaces {{site}}, {{site_testing}}, {{bucket}}, {{domain}}, {{scheme}}, and the {{<service>_version}} placeholders in s.

func DBName

func DBName(path string) string

DBName returns the database handle for the project at path: the site's slug, or the group main's database when the site is a shared-DB group secondary.

func ExpandCommands

func ExpandCommands(cmds []config.FrameworkCommand, ctx Ctx) []config.FrameworkCommand

ExpandCommands returns cmds with placeholders expanded in each shell string.

Types

type Ctx

type Ctx struct {
	Site   string // database / handle name (underscored)
	Bucket string // S3-safe bucket name (lowercase, hyphens)
	Domain string // primary domain (e.g. myapp.test)
	Scheme string // "http" or "https"
}

Ctx holds the values available to placeholders. An empty field leaves its placeholder untouched rather than substituting an empty string.

func ForPath

func ForPath(path string) Ctx

ForPath builds the context for the project at path, falling back to a name-only context when the path is not a registered site.

func ForSite

func ForSite(site *config.Site) Ctx

ForSite builds the context for a registered site.

Jump to

Keyboard shortcuts

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