Add 'environment' package
This commit adds a new environment package that manages all calls to the underlying operating system.
This commit is contained in:
parent
822c70cd69
commit
f19619ef9f
60 changed files with 539 additions and 308 deletions
|
|
@ -3,6 +3,7 @@ package component
|
|||
|
||||
import (
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/config"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
)
|
||||
|
||||
// Component represents a logical subsystem of the distillery.
|
||||
|
|
@ -38,7 +39,7 @@ type Installable interface {
|
|||
// Stack can be used to gain access to the "docker compose" stack.
|
||||
//
|
||||
// This should internally call [ComponentBase.MakeStack]
|
||||
Stack() StackWithResources
|
||||
Stack(env environment.Environment) StackWithResources
|
||||
|
||||
// Context returns a new InstallationContext to be used during installation from the command line.
|
||||
// Typically this should just pass through the parent, but might perform other tasks.
|
||||
|
|
@ -47,8 +48,14 @@ type Installable interface {
|
|||
|
||||
// ComponentBase implements base functionality for a component
|
||||
type ComponentBase struct {
|
||||
Dir string // Dir is the directory this component lives in
|
||||
Config *config.Config // Config is the configuration of the underlying distillery
|
||||
Core // the core of the associated distillery
|
||||
Dir string // Dir is the directory this component lives in
|
||||
}
|
||||
|
||||
// Core represents the core of a distillery
|
||||
type Core struct {
|
||||
Environment environment.Environment // environment to use for reading / writing to and from the distillery
|
||||
Config *config.Config // the configuration of the distillery
|
||||
}
|
||||
|
||||
// Base returns a reference to the ComponentBase
|
||||
|
|
@ -67,7 +74,8 @@ func (ComponentBase) Context(parent InstallationContext) InstallationContext {
|
|||
}
|
||||
|
||||
// MakeStack registers the Installable as a stack
|
||||
func (cb ComponentBase) MakeStack(stack StackWithResources) StackWithResources {
|
||||
func (cb ComponentBase) MakeStack(env environment.Environment, stack StackWithResources) StackWithResources {
|
||||
stack.Env = env
|
||||
stack.Dir = cb.Dir
|
||||
return stack
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue