autoconfig

package
v3.10.2 Latest Latest
Warning

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

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

Documentation

Overview

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

For example, to instantiate project.Project, you can write:

autoconfig.Invoke(func(p *project.Project) error {
    ...
})

Treat it as a dependency injection mechanism.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecorateRoot added in v3.3.3

func DecorateRoot(decorator interface{}, opts ...dig.DecorateOption) error

func InvokeForCommand added in v3.3.3

func InvokeForCommand(function interface{}, opts ...dig.InvokeOption) error

InvokeForCommand is used to invoke the function with the given dependencies. The package will automatically figure out how to instantiate them using the available configuration.

Use it only for commands because it supports only singletons created during the program initialization.

func InvokeForServer added in v3.3.3

func InvokeForServer(function interface{}, opts ...dig.InvokeOption) error

InvokeForServer is similar to InvokeForCommand, but it does not provide all the dependencies, in particular, it does not provide dependencies that differ per request.

Types

type ClientFactory added in v3.8.4

type ClientFactory func() (*runnerv2client.Client, error)

type UserConfigDir added in v3.2.5

type UserConfigDir string

Jump to

Keyboard shortcuts

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