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.
This commit is contained in:
Tom 2023-07-14 14:04:38 +02:00
parent 46b16e5700
commit 588cb7ebaa
22 changed files with 180 additions and 121 deletions

View file

@ -1,12 +0,0 @@
DATA_PATH=${DATA_PATH}
RUNTIME_DIR=${RUNTIME_DIR}
SLUG=${SLUG}
WISSKI_HOSTNAME=${HOSTNAME}
HOST_RULE=${HOST_RULE}
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME}
HTTPS_ENABLED=${HTTPS_ENABLED}
BARREL_BASE_IMAGE=${BARREL_BASE_IMAGE}
OPCACHE_MODE=${OPCACHE_MODE}

View file

@ -7,7 +7,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
)
//go:embed all:barrel barrel.env
//go:embed all:barrel
var barrelResources embed.FS
// Barrel returns a stack representing the running WissKI Instance
@ -19,15 +19,14 @@ func (barrel *Barrel) Stack() component.StackWithResources {
Resources: barrelResources,
ContextPath: filepath.Join("barrel"),
EnvPath: filepath.Join("barrel.env"),
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": barrel.Malt.Config.Docker.Network(),
"SLUG": barrel.Slug,
"HOST_RULE": barrel.HostRule(),
"HOSTNAME": barrel.Hostname(),
"HTTPS_ENABLED": barrel.Malt.Config.HTTP.HTTPSEnabledEnv(),
"SLUG": barrel.Slug,
"HOST_RULE": barrel.HostRule(),
"WISSKI_HOSTNAME": barrel.Hostname(),
"HTTPS_ENABLED": barrel.Malt.Config.HTTP.HTTPSEnabledEnv(),
"DATA_PATH": filepath.Join(barrel.FilesystemBase, "data"),
"RUNTIME_DIR": barrel.Malt.Config.Paths.RuntimeDir(),

View file

@ -1,5 +0,0 @@
SLUG=${SLUG}
HOST_RULE=${HOST_RULE}
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME}
HTTPS_ENABLED=${HTTPS_ENABLED}

View file

@ -14,7 +14,7 @@ type Reserve struct {
ingredient.Base
}
//go:embed all:reserve reserve.env
//go:embed all:reserve
var reserveResources embed.FS
// Stack returns a stack representing the reserve instance
@ -26,14 +26,12 @@ func (reserve *Reserve) Stack() component.StackWithResources {
Resources: reserveResources,
ContextPath: filepath.Join("reserve"),
EnvPath: filepath.Join("reserve.env"),
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": reserve.Malt.Config.Docker.Network(),
"SLUG": reserve.Slug,
"HOST_RULE": reserve.HostRule(),
"HOSTNAME": reserve.Hostname(),
"HTTPS_ENABLED": reserve.Malt.Config.HTTP.HTTPSEnabledEnv(),
},
}