wisski-cloud-distillery/internal/wisski/ingredient/reserve/reserve.go
Tom 588cb7ebaa stack: Do not use templates for env files
This commit removes the templating logic for writing .env files.
Instead it simply writes a key-value directory directly to the destined
file.
2023-07-14 14:06:10 +02:00

38 lines
940 B
Go

package reserve
import (
"embed"
"path/filepath"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
)
// Reserve implements reserving a WissKI Instance
// TODO: This should be integrated into the bookkeeping table.
type Reserve struct {
ingredient.Base
}
//go:embed all:reserve
var reserveResources embed.FS
// Stack returns a stack representing the reserve instance
func (reserve *Reserve) Stack() component.StackWithResources {
return component.StackWithResources{
Stack: component.Stack{
Dir: reserve.FilesystemBase,
},
Resources: reserveResources,
ContextPath: filepath.Join("reserve"),
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": reserve.Malt.Config.Docker.Network(),
"SLUG": reserve.Slug,
"HOST_RULE": reserve.HostRule(),
"HTTPS_ENABLED": reserve.Malt.Config.HTTP.HTTPSEnabledEnv(),
},
}
}