config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseDir       = ".tempo-files"
	DefaultGoPackage     = "components"
	DefaultAssetsDir     = "assets"
	DefaultSummaryFormat = "compact"
	DefaultGuardMarkText = "tempo"
)

Default values for the configuration.

Variables

View Source
var (
	DefaultNumWorkers         = runtime.NumCPU() * 2
	TempoConfigFiles          = []string{"tempo.yaml", "tempo.yml"}
	DefaultTemplateExtensions = []string{".gotxt", ".gotmpl", ".tpl"}
)

Functions

func DerivedFolderPaths

func DerivedFolderPaths(baseFolder string) (TemplatesDir, ActionsDir string)

DerivedFolderPaths returns the derived folder paths based on the base folder.

Types

type App

type App struct {
	GoModule  string `yaml:"go_module,omitempty"`
	GoPackage string `yaml:"go_package,omitempty"`
	WithJs    bool   `yaml:"with_js,omitempty"`
	CssLayer  string `yaml:"css_layer,omitempty"`
	AssetsDir string `yaml:"assets_dir,omitempty"`
}

App contains application-specific settings.

type Config

type Config struct {
	TempoRoot string    `yaml:"tempo_root"`
	App       App       `yaml:"app,omitempty"`
	Paths     Paths     `yaml:"-"`
	Processor Processor `yaml:"processor,omitempty"`
	Templates Templates `yaml:"templates,omitempty"`
}

Config represents the configuration settings for the application.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig generates a default configuration with the paths dynamically updated based on DefaultBaseFolder.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the application configuration from a file or uses default values.

type Paths

type Paths struct {
	TemplatesDir string `yaml:"-"`
	ActionsDir   string `yaml:"-"`
}

Paths defines paths used in the application.

type Processor

type Processor struct {
	Workers       int    `yaml:"workers"`
	SummaryFormat string `yaml:"summary_format"`
}

Processor defines settings for the files processing.

type TemplateFuncProvider

type TemplateFuncProvider struct {
	Name  string `yaml:"name,omitempty"`
	Type  string `yaml:"type,omitempty"` // "path" or "url"
	Value string `yaml:"value,omitempty"`
}

TemplateFuncProvider represents a function provider that can be loaded from a local path or a remote URL.

type Templates

type Templates struct {
	Extensions        []string               `yaml:"extensions,omitempty"`
	GuardMarker       string                 `yaml:"guard_marker,omitempty"`
	UserData          map[string]any         `yaml:"user_data,omitempty"`
	FunctionProviders []TemplateFuncProvider `yaml:"function_providers,omitempty"`
}

Templates defines settings related to template files and processing.

Jump to

Keyboard shortcuts

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