component: Automatically determine names
This commit is contained in:
parent
10df1c3243
commit
e320bb37bb
31 changed files with 84 additions and 113 deletions
|
|
@ -70,11 +70,11 @@ type initFunc = func(dis *Distillery, context component.ComponentPoolContext) co
|
|||
// manual initializes a component from the provided distillery.
|
||||
func manual[C component.Component](init func(component C)) initFunc {
|
||||
return func(dis *Distillery, context component.ComponentPoolContext) component.Component {
|
||||
return component.MakeComponent(context, dis.Core, init)
|
||||
return component.MakeComponent(context, dis.Still, init)
|
||||
}
|
||||
}
|
||||
|
||||
// use is like r, but does not provided additional initialization
|
||||
func auto[C component.Component](dis *Distillery, context component.ComponentPoolContext) component.Component {
|
||||
return component.MakeComponent[C](context, dis.Core, nil)
|
||||
return component.MakeComponent[C](context, dis.Still, nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
// It is the main structure used to interact with different components.
|
||||
type Distillery struct {
|
||||
// core holds the core of the distillery
|
||||
component.Core
|
||||
component.Still
|
||||
|
||||
// internal context for the distillery
|
||||
context context.Context
|
||||
|
|
@ -54,7 +54,7 @@ func (dis *Distillery) Context() context.Context {
|
|||
func e[C component.Component](dis *Distillery) C {
|
||||
return component.ExportComponent[C](
|
||||
&dis.pool,
|
||||
dis.Core,
|
||||
dis.Still,
|
||||
dis.register,
|
||||
)
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ func e[C component.Component](dis *Distillery) C {
|
|||
func ea[C component.Component](dis *Distillery) []C {
|
||||
return component.ExportComponents[C](
|
||||
&dis.pool,
|
||||
dis.Core,
|
||||
dis.Still,
|
||||
dis.register,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var errOpenConfig = exit.Error{
|
|||
func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (dis *Distillery, err error) {
|
||||
dis = &Distillery{
|
||||
context: params.Context,
|
||||
Core: component.Core{
|
||||
Still: component.Still{
|
||||
Environment: environment.Native{},
|
||||
},
|
||||
Upstream: Upstream{
|
||||
|
|
@ -38,7 +38,7 @@ func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (di
|
|||
if flags.InternalInDocker {
|
||||
dis.Upstream.SQL = "sql:3306"
|
||||
dis.Upstream.Triplestore = "triplestore:7200"
|
||||
params.ConfigPath = dis.Core.Environment.GetEnv("CONFIG_PATH")
|
||||
params.ConfigPath = dis.Still.Environment.GetEnv("CONFIG_PATH")
|
||||
}
|
||||
|
||||
// if we don't need to load the config, there is nothing to do
|
||||
|
|
@ -56,7 +56,7 @@ func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (di
|
|||
}
|
||||
|
||||
// open the config file!
|
||||
f, err := dis.Core.Environment.Open(params.ConfigPath)
|
||||
f, err := dis.Still.Environment.Open(params.ConfigPath)
|
||||
if err != nil {
|
||||
return nil, errOpenConfig.WithMessageF(err)
|
||||
}
|
||||
|
|
@ -66,6 +66,6 @@ func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (di
|
|||
dis.Config = &config.Config{
|
||||
ConfigPath: cfg,
|
||||
}
|
||||
err = dis.Config.Unmarshal(dis.Core.Environment, f)
|
||||
err = dis.Config.Unmarshal(dis.Still.Environment, f)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue