This repository has been archived on 2023-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
helix/internal/stacks/templates.go
Dan Anglin fda0d6a682
feat: add traefik in the new containers stack
This commit adds the new containers stack which
now builds the traefik docker image and creates
the traefik docker container.

Pulumi needed to be downgraded to version 3.2.1
because later versions panic when building
the docker image.
2021-07-10 12:41:15 +01:00

24 lines
571 B
Go

package stacks
import (
"fmt"
"os"
"text/template"
)
// generateFile renders a given template to a given filepath.
func generateFile(data interface{}, templateString, templateName, path string) error {
file, err := os.Create(path)
if err != nil {
return fmt.Errorf("unable to create the file '%s'...\n%v", path, err)
}
defer file.Close()
tmpl := template.Must(template.New(templateName).Parse(templateString))
if err = tmpl.Execute(file, data); err != nil {
return fmt.Errorf("unable to execute the template at '%s'...\n%v", path, err)
}
return nil
}