about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--context/context.go4
-rw-r--r--templater/templater.go6
-rw-r--r--util/util.go3
3 files changed, 8 insertions, 5 deletions
diff --git a/context/context.go b/context/context.go
index fe04a051ef..0be42d6d22 100644
--- a/context/context.go
+++ b/context/context.go
@@ -143,9 +143,7 @@ func loadAllDefaultValues(c *Context) []ResourceSet {
 func loadDefaultValues(rs *ResourceSet, c *Context) *map[string]interface{} {
 	var defaultVars map[string]interface{}
 
-	defaultFilenames := []string{"default.yml", "default.yaml", "default.json"}
-
-	for _, filename := range defaultFilenames {
+	for _, filename := range util.DefaultFilenames {
 		err := util.LoadJsonOrYaml(path.Join(c.BaseDir, rs.Path, filename), &defaultVars)
 		if err == nil {
 			return util.Merge(&defaultVars, &rs.Values)
diff --git a/templater/templater.go b/templater/templater.go
index 4a0c8e7d8d..f6878d3dfa 100644
--- a/templater/templater.go
+++ b/templater/templater.go
@@ -186,8 +186,10 @@ func templateFuncs() template.FuncMap {
 
 // Checks whether a file is a resource file (i.e. is YAML or JSON) and not a default values file.
 func isResourceFile(f os.FileInfo) bool {
-	if f.Name() == "default.json" || f.Name() == "default.yaml" {
-		return false
+	for _, defaultFile := range util.DefaultFilenames {
+		if f.Name() == defaultFile {
+			return false
+		}
 	}
 
 	return strings.HasSuffix(f.Name(), "yaml") ||
diff --git a/util/util.go b/util/util.go
index 0c5815a38b..eb8806036b 100644
--- a/util/util.go
+++ b/util/util.go
@@ -9,6 +9,9 @@ import (
 	"github.com/ghodss/yaml"
 )
 
+// Filenames excluded from templating for the purpose of containing default variable values inside a resource set.
+var DefaultFilenames []string = []string{"default.yml", "default.yaml", "default.json"}
+
 // Merges two maps together. Values from the second map override values in the first map.
 // The returned map is new if anything was changed.
 func Merge(in1 *map[string]interface{}, in2 *map[string]interface{}) *map[string]interface{} {