admin

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package admin is templates' internal API: the console module's editor, served as gRPC on the platform port behind the internal secret and relayed by backplane under the operator's session. Every change is an audit record.

Index

Constants

View Source
const FilesAuthor = "files"

FilesAuthor is the author of the versions the files source writes.

Variables

View Source
var ErrFiles = errors.New("templates: files source")

ErrFiles: the files source is not a valid set of templates.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	templatesconsolev1.UnimplementedAdminServiceServer
	deps.Component
	// contains filtered or unexported fields
}

Admin serves AdminService.

func New

func New(parent deps.Scope, st deps.Dependency[*store.Store], t *templates.Templates) *Admin

New creates the admin component under parent.

func (*Admin) ActivateVersion

ActivateVersion implements AdminService.

func (*Admin) DeleteTemplate

DeleteTemplate implements AdminService.

func (*Admin) GetSettings added in v0.2.0

GetSettings implements AdminService.

func (*Admin) GetTemplate

GetTemplate implements AdminService.

func (*Admin) ListTemplates

ListTemplates implements AdminService.

func (*Admin) Preview

Preview implements AdminService.

func (*Admin) SaveTemplate

SaveTemplate implements AdminService.

type FileSet added in v0.2.7

type FileSet struct {
	Templates map[string]FileTemplate
	Digest    string
}

FileSet is what a directory holds: templates by name, and its digest.

func ReadFiles added in v0.2.7

func ReadFiles(dir, fallback string) (FileSet, error)

ReadFiles reads the directory whole (any error fails it all); fallback is the default language of a template that names none and has several.

type FileTemplate added in v0.2.7

type FileTemplate struct {
	Description string
	Content     templates.Content
	Sample      map[string]any
}

FileTemplate is a template as its directory says.

type Files added in v0.2.7

type Files struct {
	deps.Component
	// contains filtered or unexported fields
}

Files keeps the templates of a directory in force: the directory is the desired state, and the console only reads (and previews) what it holds.

Every subdirectory is one template, named by it:

kratos.recovery_code_valid/
  template.yaml        # optional: description, default_language, sample
  en/subject.txt       # <language>/<part>.<ext>: .txt a text part, .html an html one
  en/html.html
  ru/subject.txt
  ru/html.html
_footer/
  en/html.html         # a shared piece: its part named as the including part (or its only one)

Names starting with a dot are skipped (a Kubernetes ConfigMap's ..data). A pass saves what differs from a template's active version as a new version and activates it; a template a directory no longer holds is deleted. A template that does not compile keeps the version in force; a directory that does not read whole changes nothing. Replicas run it side by side and converge.

func NewFiles added in v0.2.7

func NewFiles(parent deps.Scope, a *Admin, dir string, poll time.Duration) *Files

NewFiles creates the component under parent: the directory dir, read every poll (0: 5s).

Jump to

Keyboard shortcuts

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