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