Documentation
¶
Overview ¶
Package config contains APIs used to work with injector configuration files, which are formed by FilenameOrchestrionToolGo and FilenameOrchestrionYML files.
Index ¶
Constants ¶
const FilenameOrchestrionToolGo = "orchestrion.tool.go"
const FilenameOrchestrionYML = "orchestrion.yml"
Variables ¶
var ErrInvalidGoPackage = errors.New("no .go files in package")
Functions ¶
func HasConfig ¶
func HasConfig(ctx context.Context, pkgLoader PackageLoader, pkg *packages.Package, validate bool) (bool, error)
HasConfig determines whether the specified package contains injector configuration, and optionally validates it. If the PackageLoader is nil, a default implementation is used.
func ValidateObject ¶
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 returns all aspects defined in this configuration in a single list.
Aspects() []*aspect.Aspect
// contains filtered or unexported methods
}
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(pkgLoader PackageLoader, dir string, validate bool) *Loader
NewLoader creates a new Loader in the specified directory.
If the [PackageLoader] is nil, a default implementation is used.
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.