wisski-cloud-distillery/env/stack_web.go
Tom Wiesing 09431c4869
env: Move each component into a separate struct
This commit cleans up the distillery code by making each component a
distinct struct. Each of these components is also returned by by a new
Component() function that replaces the Stacks() function.
2022-09-08 14:39:04 +02:00

29 lines
658 B
Go

package env
import "github.com/FAU-CDI/wisski-distillery/internal/stack"
// WebComponent represents the 'web' layer belonging to a distillery
type WebComponent struct {
dis *Distillery
}
// Web returns the WebComponent belonging to this distillery
func (dis *Distillery) Web() WebComponent {
return WebComponent{dis: dis}
}
func (WebComponent) Name() string {
return "web"
}
func (web WebComponent) Stack() stack.Installable {
return web.dis.makeComponentStack(web, stack.Installable{
EnvFileContext: map[string]string{
"DEFAULT_HOST": web.dis.Config.DefaultDomain,
},
})
}
func (web WebComponent) Path() string {
return web.Stack().Dir
}