generator

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package generator hosts FastConf's built-in contracts.Generator implementations. Generators synthesise configuration layers dynamically at assemble time. They are first-class peers of Provider but produce []contracts.Source instead of one map[string]any.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	// NameStr overrides Name(); defaults to "buildinfo".
	NameStr string
	// Keys map dotted paths to string values.
	Keys map[string]string
}

BuildInfo emits a single JSON Source containing the supplied dotted.key=value pairs. Typical use: stamp `app.version`, `app.commit`, and `app.builtAt` at link time into the config tree so downstream services can serve /healthz with build provenance.

Example:

fastconf.WithGenerator(&generator.BuildInfo{
    Keys: map[string]string{
        "app.version": Version,
        "app.commit":  Commit,
    },
})

func (*BuildInfo) Generate

func (b *BuildInfo) Generate(_ context.Context) ([]contracts.Source, error)

Generate implements contracts.Generator.

func (*BuildInfo) Name

func (b *BuildInfo) Name() string

Name implements contracts.Generator.

Jump to

Keyboard shortcuts

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