mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 06:59:51 +02:00
@@ -5,3 +5,12 @@ type Context struct {
|
||||
basePath string
|
||||
readFile func(string) ([]byte, error)
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for the template
|
||||
func (c *Context) SetBasePath(path string) {
|
||||
c.basePath = path
|
||||
}
|
||||
|
||||
func (c *Context) SetReadFile(f func(string) ([]byte, error)) {
|
||||
c.readFile = f
|
||||
}
|
||||
|
||||
@@ -172,6 +172,10 @@ func (c *Context) ReadFile(filename string) (string, error) {
|
||||
path = filepath.Join(c.basePath, filename)
|
||||
}
|
||||
|
||||
if c.readFile == nil {
|
||||
return "", fmt.Errorf("readFile is not implemented")
|
||||
}
|
||||
|
||||
bytes, err := c.readFile(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user