config

package
v3.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilterTypeBlock    = "FILTER_TYPE_BLOCK"
	FilterTypeDocument = "FILTER_TYPE_DOCUMENT"
)

Variables

View Source
var ErrRootConfigNotFound = errors.New("root configuration file not found")

Functions

This section is empty.

Types

type Config

type Config struct {
	// Client corresponds to the JSON schema field "client".
	Client *ConfigClient `json:"client,omitempty" yaml:"client,omitempty"`

	// Log corresponds to the JSON schema field "log".
	Log *ConfigLog `json:"log,omitempty" yaml:"log,omitempty"`

	// Project corresponds to the JSON schema field "project".
	Project ConfigProject `json:"project" yaml:"project"`

	// Runtime corresponds to the JSON schema field "runtime".
	Runtime *ConfigRuntime `json:"runtime,omitempty" yaml:"runtime,omitempty"`

	// Server corresponds to the JSON schema field "server".
	Server *ConfigServer `json:"server,omitempty" yaml:"server,omitempty"`

	// Version corresponds to the JSON schema field "version".
	Version string `json:"version" yaml:"version"`
}

Runme configuration schema

func Default added in v3.8.4

func Default() *Config

func ParseYAML

func ParseYAML(items ...[]byte) (*Config, error)

ParseYAML parses the given YAML items and returns a configuration object. Multiple items are merged into a single configuration. It uses a default configuration as a base.

func (*Config) UnmarshalJSON added in v3.8.4

func (j *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigClient added in v3.8.4

type ConfigClient struct {
	// ServerAddress corresponds to the JSON schema field "server_address".
	ServerAddress string `json:"server_address" yaml:"server_address"`
}

func (*ConfigClient) UnmarshalJSON added in v3.8.4

func (j *ConfigClient) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigLog added in v3.8.4

type ConfigLog struct {
	// Enabled corresponds to the JSON schema field "enabled".
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Path corresponds to the JSON schema field "path".
	Path string `json:"path" yaml:"path"`

	// Verbose corresponds to the JSON schema field "verbose".
	Verbose bool `json:"verbose,omitempty" yaml:"verbose,omitempty"`
}

func (*ConfigLog) UnmarshalJSON added in v3.8.4

func (j *ConfigLog) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigProject added in v3.8.4

type ConfigProject struct {
	// DisableGitignore corresponds to the JSON schema field "disable_gitignore".
	DisableGitignore bool `json:"disable_gitignore,omitempty" yaml:"disable_gitignore,omitempty"`

	// Env corresponds to the JSON schema field "env".
	Env *ConfigProjectEnv `json:"env,omitempty" yaml:"env,omitempty"`

	// Filename corresponds to the JSON schema field "filename".
	Filename string `json:"filename,omitempty" yaml:"filename,omitempty"`

	// Filters corresponds to the JSON schema field "filters".
	Filters []ConfigProjectFiltersElem `json:"filters,omitempty" yaml:"filters,omitempty"`

	// FindRepoUpward corresponds to the JSON schema field "find_repo_upward".
	FindRepoUpward bool `json:"find_repo_upward,omitempty" yaml:"find_repo_upward,omitempty"`

	// Ignore corresponds to the JSON schema field "ignore".
	Ignore []string `json:"ignore,omitempty" yaml:"ignore,omitempty"`

	// Root corresponds to the JSON schema field "root".
	Root string `json:"root,omitempty" yaml:"root,omitempty"`
}

func (*ConfigProject) UnmarshalJSON added in v3.8.4

func (j *ConfigProject) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigProjectEnv added in v3.8.4

type ConfigProjectEnv struct {
	// Sources corresponds to the JSON schema field "sources".
	Sources []string `json:"sources,omitempty" yaml:"sources,omitempty"`

	// UseSystemEnv corresponds to the JSON schema field "use_system_env".
	UseSystemEnv bool `json:"use_system_env,omitempty" yaml:"use_system_env,omitempty"`
}

func (*ConfigProjectEnv) UnmarshalJSON added in v3.8.4

func (j *ConfigProjectEnv) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigProjectFiltersElem added in v3.8.4

type ConfigProjectFiltersElem struct {
	// Condition corresponds to the JSON schema field "condition".
	Condition string `json:"condition" yaml:"condition"`

	// Extra corresponds to the JSON schema field "extra".
	Extra ConfigProjectFiltersElemExtra `json:"extra,omitempty" yaml:"extra,omitempty"`

	// Type corresponds to the JSON schema field "type".
	Type ConfigProjectFiltersElemType `json:"type" yaml:"type"`
}

func (*ConfigProjectFiltersElem) UnmarshalJSON added in v3.8.4

func (j *ConfigProjectFiltersElem) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigProjectFiltersElemExtra added in v3.8.4

type ConfigProjectFiltersElemExtra map[string]interface{}

type ConfigProjectFiltersElemType added in v3.8.4

type ConfigProjectFiltersElemType string
const ConfigProjectFiltersElemTypeFILTERTYPEBLOCK ConfigProjectFiltersElemType = "FILTER_TYPE_BLOCK"
const ConfigProjectFiltersElemTypeFILTERTYPEDOCUMENT ConfigProjectFiltersElemType = "FILTER_TYPE_DOCUMENT"

func (*ConfigProjectFiltersElemType) UnmarshalJSON added in v3.8.4

func (j *ConfigProjectFiltersElemType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigRuntime added in v3.8.4

type ConfigRuntime struct {
	// Docker corresponds to the JSON schema field "docker".
	Docker *ConfigRuntimeDocker `json:"docker,omitempty" yaml:"docker,omitempty"`
}

type ConfigRuntimeDocker added in v3.8.4

type ConfigRuntimeDocker struct {
	// Build corresponds to the JSON schema field "build".
	Build *ConfigRuntimeDockerBuild `json:"build,omitempty" yaml:"build,omitempty"`

	// Enabled corresponds to the JSON schema field "enabled".
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Image corresponds to the JSON schema field "image".
	Image string `json:"image" yaml:"image"`
}

func (*ConfigRuntimeDocker) UnmarshalJSON added in v3.8.4

func (j *ConfigRuntimeDocker) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigRuntimeDockerBuild added in v3.8.4

type ConfigRuntimeDockerBuild struct {
	// Context corresponds to the JSON schema field "context".
	Context string `json:"context" yaml:"context"`

	// Dockerfile corresponds to the JSON schema field "dockerfile".
	Dockerfile string `json:"dockerfile" yaml:"dockerfile"`
}

func (*ConfigRuntimeDockerBuild) UnmarshalJSON added in v3.8.4

func (j *ConfigRuntimeDockerBuild) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigServer added in v3.8.4

type ConfigServer struct {
	// Address corresponds to the JSON schema field "address".
	Address string `json:"address" yaml:"address"`

	// Tls corresponds to the JSON schema field "tls".
	Tls *ConfigServerTls `json:"tls,omitempty" yaml:"tls,omitempty"`
}

func (*ConfigServer) UnmarshalJSON added in v3.8.4

func (j *ConfigServer) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ConfigServerTls added in v3.8.4

type ConfigServerTls struct {
	// CertFile corresponds to the JSON schema field "cert_file".
	CertFile *string `json:"cert_file,omitempty" yaml:"cert_file,omitempty"`

	// Enabled corresponds to the JSON schema field "enabled".
	Enabled bool `json:"enabled" yaml:"enabled"`

	// KeyFile corresponds to the JSON schema field "key_file".
	KeyFile *string `json:"key_file,omitempty" yaml:"key_file,omitempty"`
}

func (*ConfigServerTls) UnmarshalJSON added in v3.8.4

func (j *ConfigServerTls) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Filter

type Filter struct {
	Type      string
	Condition string
	Extra     map[string]interface{}
}

func (*Filter) Evaluate

func (f *Filter) Evaluate(env interface{}) (bool, error)

type FilterBlockEnv

type FilterBlockEnv struct {
	Background             bool     `expr:"background"`
	CloseTerminalOnSuccess bool     `expr:"close_terminal_on_success"`
	Cwd                    string   `expr:"cwd"`
	ExcludeFromRunAll      bool     `expr:"exclude_from_run_all"`
	Interactive            bool     `expr:"interactive"`
	IsNamed                bool     `expr:"is_named"`
	Language               string   `expr:"language"`
	Name                   string   `expr:"name"`
	PromptEnv              bool     `expr:"prompt_env"`
	Tags                   []string `expr:"tags"`
}

FilterBlockEnv is the environment with fields corresponding to the options documented on https://docs.runme.dev/configuration/cell-level. Cell options are converted to this environment before evaluating the filter.

The `expr` tag is used to map the field to the corresponding option. Without it, all variables start with capitalized letters.

type FilterDocumentEnv

type FilterDocumentEnv struct {
	Cwd   string `expr:"cwd"`
	Shell string `expr:"shell"`
}

FilterDocumentEnv is the environment with fields corresponding to the options documented on https://docs.runme.dev/configuration/document-level. Document options are converted to this environment before evaluating the filter.

type Loader added in v3.3.1

type Loader struct {
	// contains filtered or unexported fields
}

Loader allows to load configuration files from a file system.

func NewLoader added in v3.3.1

func NewLoader(configNames []string, configRootPath fs.FS, opts ...LoaderOption) *Loader

func (*Loader) FindConfigChain added in v3.3.1

func (l *Loader) FindConfigChain(path string) ([][]byte, error)

func (*Loader) RootConfigs added in v3.8.4

func (l *Loader) RootConfigs() ([][]byte, error)

func (*Loader) SetConfigRootPath added in v3.3.1

func (l *Loader) SetConfigRootPath(configRootPath fs.FS)

type LoaderOption added in v3.3.1

type LoaderOption func(*Loader)

func WithLogger added in v3.3.1

func WithLogger(logger *zap.Logger) LoaderOption

func WithProjectRootPath added in v3.3.1

func WithProjectRootPath(projectRootPath fs.FS) LoaderOption

Directories

Path Synopsis
autoconfig provides a way to create instances of objects based on the configuration in runme.yaml.
autoconfig provides a way to create instances of objects based on the configuration in runme.yaml.

Jump to

Keyboard shortcuts

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