Require access to Still via method

This commit adds a safeguard to accessing the still from a specific
component by requiring access via the component.GetStill method.
This commit is contained in:
Tom Wiesing 2024-04-08 22:39:32 +02:00
parent 81fa84c244
commit 8235ea9105
No known key found for this signature in database
63 changed files with 288 additions and 197 deletions

View file

@ -21,7 +21,7 @@ var (
)
func (web *Web) Path() string {
return filepath.Join(web.Still.Config.Paths.Root, "core", "web")
return filepath.Join(component.GetStill(web).Config.Paths.Root, "core", "web")
}
func (*Web) Context(parent component.InstallationContext) component.InstallationContext {
@ -37,12 +37,13 @@ var dockerComposeHTTPS []byte
func (web *Web) Stack() component.StackWithResources {
var stack component.StackWithResources
config := component.GetStill(web).Config
stack.EnvContext = map[string]string{
"DOCKER_NETWORK_NAME": web.Config.Docker.Network(),
"CERT_EMAIL": web.Config.HTTP.CertbotEmail,
"DOCKER_NETWORK_NAME": config.Docker.Network(),
"CERT_EMAIL": config.HTTP.CertbotEmail,
}
if web.Config.HTTP.HTTPSEnabled() {
if config.HTTP.HTTPSEnabled() {
stack.ComposerYML = readYaml(dockerComposeHTTPS)
stack.TouchFilesPerm = 0600
stack.TouchFiles = []string{"acme.json"}