mv 'env/stack{,_*}.go' => 'env/component{,_*}.go'

This commit is contained in:
Tom Wiesing 2022-09-05 15:53:27 +02:00
parent 09431c4869
commit 54747e267e
No known key found for this signature in database
7 changed files with 0 additions and 0 deletions

43
env/component.go vendored Normal file
View file

@ -0,0 +1,43 @@
package env
import (
"path/filepath"
"github.com/FAU-CDI/wisski-distillery/internal/stack"
)
// TODO: Move everything into specific subpackages
// Stacks returns the Stacks of this distillery
func (dis *Distillery) Components() []Component {
// TODO: Do we want to cache these stacks?
return []Component{
dis.Web(),
dis.Self(),
dis.Resolver(),
dis.SSH(),
dis.Triplestore(),
dis.SQL(),
}
}
// Component represents a component of the distillery
type Component interface {
Name() string // Name is the name of this component
Stack() stack.Installable // Stack returns the installable stack representing this component
Path() string // Path returns the path to this component
}
// asCoreStack treats the provided stack as a core component of this distillery.
func (dis *Distillery) makeComponentStack(component Component, stack stack.Installable) stack.Installable {
name := component.Name()
stack.Dir = filepath.Join(dis.Config.DeployRoot, "core", name)
stack.ContextResource = filepath.Join("resources", "compose", name)
stack.EnvFileResource = filepath.Join("resources", "templates", "docker-env", name)
return stack
}