From 2be825b9753b0ad7c9e838a1701b45f99d672d73 Mon Sep 17 00:00:00 2001 From: romanprog Date: Wed, 3 Jan 2024 16:46:08 +0200 Subject: [PATCH] fix templatePath --- pkg/project/template_freader.go | 38 --------------------------------- pkg/project/templating.go | 2 +- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 pkg/project/template_freader.go diff --git a/pkg/project/template_freader.go b/pkg/project/template_freader.go deleted file mode 100644 index 9bfd22e2..00000000 --- a/pkg/project/template_freader.go +++ /dev/null @@ -1,38 +0,0 @@ -package project - -import ( - "os" - "path/filepath" - - "github.com/apex/log" -) - -type tmplFileReader struct { - stackPtr *Stack -} - -func (t tmplFileReader) ReadFile(path string) (string, error) { - vfPath := filepath.Join(t.stackPtr.TemplateDir, path) - valuesFileContent, err := os.ReadFile(vfPath) - if err != nil { - log.Debugf(err.Error()) - return "", err - } - return string(valuesFileContent), nil -} - -func (t tmplFileReader) TemplateFile(path string) (string, error) { - vfPath := filepath.Join(t.stackPtr.TemplateDir, path) - rawFile, err := os.ReadFile(vfPath) - if err != nil { - log.Debugf(err.Error()) - return "", err - } - templatedFile, errIsWarn, err := t.stackPtr.TemplateTry(rawFile, vfPath) - if err != nil { - if !errIsWarn { - return "", err - } - } - return string(templatedFile), nil -} diff --git a/pkg/project/templating.go b/pkg/project/templating.go index d5f3d743..b5252a04 100644 --- a/pkg/project/templating.go +++ b/pkg/project/templating.go @@ -55,7 +55,7 @@ func (f *ExtendedFuncMap) Get(path string, s *Stack) template.FuncMap { p = config.Global.ProjectConfigsPath } else { pathFuncName = "templatePath" - p = filepath.Join(s.TemplateDir) + p = filepath.Join(config.Global.ProjectConfigsPath, s.TemplateDir) } getPath := func() string { return p