Skip to content

Commit

Permalink
adding literal colon to interpolated regex
Browse files Browse the repository at this point in the history
  • Loading branch information
lamdor committed Dec 21, 2014
1 parent fd6382f commit e970eea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/interpolate_walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const InterpSplitDelim = `B780FFEC-B661-4EB8-9236-A01737AD98B6`

// 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
Expand Down
19 changes: 19 additions & 0 deletions config/interpolate_walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,25 @@ func TestInterpolationWalker_detect(t *testing.T) {
},
},
},

{
Input: map[string]interface{}{
"foo": `${concat("localhost", ":8080")}`,
},
Result: []Interpolation{
&FunctionInterpolation{
Func: nil,
Args: []Interpolation{
&LiteralInterpolation{
Literal: "localhost",
},
&LiteralInterpolation{
Literal: ":8080",
},
},
},
},
},
}

for i, tc := range cases {
Expand Down

0 comments on commit e970eea

Please sign in to comment.