config: accept file("test.txt") [GH-145]

This commit is contained in:
Mitchell Hashimoto 2014-08-05 10:28:20 -07:00
parent 40bd1580e4
commit 742e33c672
2 changed files with 17 additions and 1 deletions

View File

@ -11,7 +11,7 @@ import (
// interpRegexp is a regexp that matches interpolations such as ${foo.bar} // interpRegexp is a regexp that matches interpolations such as ${foo.bar}
var interpRegexp *regexp.Regexp = regexp.MustCompile( var interpRegexp *regexp.Regexp = regexp.MustCompile(
`(?i)(\$+)\{([\s*-.,\(\)a-z0-9_]+)\}`) `(?i)(\$+)\{([\s*-.,\(\)a-z0-9_"]+)\}`)
// interpolationWalker implements interfaces for the reflectwalk package // interpolationWalker implements interfaces for the reflectwalk package
// (github.com/mitchellh/reflectwalk) that can be used to automatically // (github.com/mitchellh/reflectwalk) that can be used to automatically

View File

@ -71,6 +71,22 @@ func TestInterpolationWalker_detect(t *testing.T) {
}, },
}, },
}, },
{
Input: map[string]interface{}{
"foo": `${file("test.txt")}`,
},
Result: []Interpolation{
&FunctionInterpolation{
Func: nil,
Args: []Interpolation{
&LiteralInterpolation{
Literal: "test.txt",
},
},
},
},
},
} }
for i, tc := range cases { for i, tc := range cases {