From 742e33c6723c737d5f95decf5da660d59fa21f37 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 5 Aug 2014 10:28:20 -0700 Subject: [PATCH] config: accept file("test.txt") [GH-145] --- config/interpolate_walk.go | 2 +- config/interpolate_walk_test.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config/interpolate_walk.go b/config/interpolate_walk.go index 3e2d5db12..8e3831740 100644 --- a/config/interpolate_walk.go +++ b/config/interpolate_walk.go @@ -11,7 +11,7 @@ import ( // interpRegexp is a regexp that matches interpolations such as ${foo.bar} var interpRegexp *regexp.Regexp = regexp.MustCompile( - `(?i)(\$+)\{([\s*-.,\(\)a-z0-9_]+)\}`) + `(?i)(\$+)\{([\s*-.,\(\)a-z0-9_"]+)\}`) // interpolationWalker implements interfaces for the reflectwalk package // (github.com/mitchellh/reflectwalk) that can be used to automatically diff --git a/config/interpolate_walk_test.go b/config/interpolate_walk_test.go index e1ff006a3..ca733c709 100644 --- a/config/interpolate_walk_test.go +++ b/config/interpolate_walk_test.go @@ -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 {