Skip to content

Commit

Permalink
fix: temp fix for ignoring archive files
Browse files Browse the repository at this point in the history
  • Loading branch information
graytonio committed Apr 28, 2024
1 parent d28639c commit 42d9ee4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/templ/templ.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"bytes"
"io"
"io/fs"
"path/filepath"
"slices"
"text/template"

"github.com/Masterminds/sprig/v3"
Expand All @@ -26,6 +28,16 @@ type TemplateEngine struct {
funcMap map[string]any
}

// TODO Move to config
var ignoreFileExtentions = []string{
".tar",
".tar.gz",
".tgz",
".zip",
".gz",
".7z",
}

// Parses configured paths and available providers to create list of engine tasks to be executed
func CreateEngines(paths []config.Path, providers map[string]*openfeature.Client) ([]*TemplateEngine, error) {
engines := []*TemplateEngine{}
Expand Down Expand Up @@ -112,6 +124,10 @@ func (te *TemplateEngine) executeFileTemplate(path string) error {
return err
}

if slices.Contains(ignoreFileExtentions, filepath.Ext(path)) {
return te.Output.ExecuteFile(path, data)
}

templ, err := template.New(path).
Delims("[{", "}]").
Funcs(te.funcMap).
Expand Down

0 comments on commit 42d9ee4

Please sign in to comment.