config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config contains APIs used to work with injector configuration files, which are formed by FilenameOrchestrionToolGo and FilenameOrchestrionYML files.

Index

Constants

View Source
const FilenameOrchestrionToolGo = "orchestrion.tool.go"
View Source
const FilenameOrchestrionYML = "orchestrion.yml"

Variables

View Source
var ErrInvalidGoPackage = errors.New("no .go files in package")

Functions

func HasConfig

func HasConfig(pkg *packages.Package, validate bool) (bool, error)

HasConfig determines whether the specified package contains injector configuration, and optionally validates it.

func ValidateObject

func ValidateObject(obj map[string]any) error

ValidateObject checks the provided object for conformance to the embedded JSON schema. Returns an error if the object does not conform to the schema.

Types

type Config

type Config interface {
	Aspects() []*aspect.Aspect
}

Config represents an injector's configuration. It can be obtained using Loader.Load.

type Loader

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

Loader is a facility to load configuration from available sources.

func NewLoader

func NewLoader(dir string, validate bool) *Loader

NewLoader creates a new Loader in the specified directory. The directory is used to resolve relative paths and must be a valid Go package directory, meaning it must contain at least one `.go` file. If [Loader.validate] is true, the YAML documents will be validated against the JSON schema.

func (*Loader) Load

func (l *Loader) Load() (Config, error)

Load proceeds to load the configuration from this loader's directory.

Jump to

Keyboard shortcuts

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