conf

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read added in v0.7.0

func Read(
	rc dukkha.ConfigResolvingContext,
	rootfs fs.FS,
	configPaths []string,
	ignoreFileNotExist bool,
	visitedPaths *map[string]struct{},
	mergedConfig *Config,
) error

Read config in rootfs recursively

Types

type Config

type Config struct {
	rs.BaseField `yaml:"-"`

	// Global options only have limited rendering suffix support
	Global GlobalConfig `yaml:"global"`

	// Include other files using path relative to current file
	// only local path is supported
	//
	// With path glob pattern '*' and '**' support
	Include []*IncludeEntry `yaml:"include"`

	// Shells for command execution
	Shells []*tools.ShellTool `yaml:"shells"`

	// Renderers config options
	Renderers []*RendererGroup `yaml:"renderers"`

	// Tools config options for registered tools
	Tools Tools `yaml:"tools"`

	Tasks map[string][]dukkha.Task `yaml:",inline"`
}

func NewConfig

func NewConfig() *Config

func (*Config) Merge

func (c *Config) Merge(a *Config) error

func (*Config) Resolve

func (c *Config) Resolve(appCtx dukkha.ConfigResolvingContext, needTasks bool) error

Resolve resolves all top level dukkha config to gain an overview of all tools and tasks

type GlobalConfig

type GlobalConfig struct {
	rs.BaseField `yaml:"-"`

	// DefaultGitBranch set GIT_DEFAULT_BRANCH, useful when dukkha can not
	// detect branch name of origin/HEAD (e.g. github ci environment)
	//
	// If your have multiple definitions of this option in different config
	// file, only the first occurrence of the option is used.
	DefaultGitBranch string `yaml:"default_git_branch"`

	// Env add global environment variables for all working parts in dukkha
	Env dukkha.Env `yaml:"env"`

	// Values is the global store of runtime values
	//
	// accessible from renderer template `{{ values.YOUR_VAL_KEY }}`
	// and renderer env/shell `${values.YOUR_VAL_KEY}`
	Values rs.AnyObjectMap `yaml:"values"`
}

func (*GlobalConfig) Merge

func (g *GlobalConfig) Merge(a *GlobalConfig) error

func (*GlobalConfig) ResolveAllButValues

func (g *GlobalConfig) ResolveAllButValues(rc dukkha.ConfigResolvingContext) error

ResolveAllButValues resolves global env first, and make them available to all other fields, then resolves all other fields except values (will be handled later)

type IncludeEntry added in v0.7.0

type IncludeEntry struct {
	rs.BaseField `yaml:",inline"`

	// Path is the local path to include, can be either directory or file
	//
	// Path and Text are mutually exclusive
	Path string `yaml:"path"`

	// Text is the config text to include, usually used with rendering suffix
	// to include remote config
	//
	// Path and Text are mutually exclusive
	Text string `yaml:"text"`
}

type RendererGroup added in v0.7.0

type RendererGroup struct {
	rs.BaseField

	Renderers map[string]dukkha.Renderer `yaml:",inline"`
}

RendererGroup contains a group of renderers can be initialized without depending on each other

type Tools added in v0.2.0

type Tools struct {
	rs.BaseField `yaml:"-"`

	Tools map[string][]dukkha.Tool `yaml:",inline"`
}

func (*Tools) Merge added in v0.2.0

func (m *Tools) Merge(a *Tools) error

Jump to

Keyboard shortcuts

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