Add local.settings.php to every instance

This commit adds a new file 'local.settings.php' to each distillery
instance. This file can be used to automatically edit global distillery
settings.
This commit is contained in:
Tom Wiesing 2024-04-01 16:41:11 +02:00
parent 6eab3ac311
commit 24ff81f7cd
No known key found for this signature in database
13 changed files with 98 additions and 42 deletions

View file

@ -4,12 +4,19 @@ import (
"embed"
"path/filepath"
_ "embed"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
)
//go:embed all:barrel
var barrelResources embed.FS
const localSettingsName = "settings.local.php"
//go:embed local.settings.php
var localSettingsTemplate string
// Barrel returns a stack representing the running WissKI Instance
func (barrel *Barrel) Stack() component.StackWithResources {
return component.StackWithResources{
@ -20,6 +27,10 @@ func (barrel *Barrel) Stack() component.StackWithResources {
Resources: barrelResources,
ContextPath: filepath.Join("barrel"),
CreateFiles: map[string]string{
localSettingsName: localSettingsTemplate,
},
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": barrel.Malt.Config.Docker.Network(),
@ -31,6 +42,9 @@ func (barrel *Barrel) Stack() component.StackWithResources {
"DATA_PATH": filepath.Join(barrel.FilesystemBase, "data"),
"RUNTIME_DIR": barrel.Malt.Config.Paths.RuntimeDir(),
"LOCAL_SETTINGS_PATH": filepath.Join(barrel.FilesystemBase, localSettingsName),
"LOCAL_SETTINGS_MOUNT": LocalSettingsPath,
"BARREL_BASE_IMAGE": barrel.GetDockerBaseImage(),
"IIP_SERVER_ENABLED": barrel.GetIIPServerEnabled(),
"OPCACHE_MODE": barrel.OpCacheMode(),