Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 69ca9ef

Browse files
committed
Merge pull request hashicorp#700 from Banno/fix-interpolated-func-with-colon
Adding colon to interpolated regex so they can be used in concats
2 parents 11dc775 + e970eea commit 69ca9ef

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

config/interpolate_walk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const InterpSplitDelim = `B780FFEC-B661-4EB8-9236-A01737AD98B6`
1616

1717
// interpRegexp is a regexp that matches interpolations such as ${foo.bar}
1818
var interpRegexp *regexp.Regexp = regexp.MustCompile(
19-
`(?i)(\$+)\{([\s*-.,\\/\(\)a-z0-9_"]+)\}`)
19+
`(?i)(\$+)\{([\s*-.,\\/\(\):a-z0-9_"]+)\}`)
2020

2121
// interpolationWalker implements interfaces for the reflectwalk package
2222
// (github.com/mitchellh/reflectwalk) that can be used to automatically

config/interpolate_walk_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,25 @@ func TestInterpolationWalker_detect(t *testing.T) {
129129
},
130130
},
131131
},
132+
133+
{
134+
Input: map[string]interface{}{
135+
"foo": `${concat("localhost", ":8080")}`,
136+
},
137+
Result: []Interpolation{
138+
&FunctionInterpolation{
139+
Func: nil,
140+
Args: []Interpolation{
141+
&LiteralInterpolation{
142+
Literal: "localhost",
143+
},
144+
&LiteralInterpolation{
145+
Literal: ":8080",
146+
},
147+
},
148+
},
149+
},
150+
},
132151
}
133152

134153
for i, tc := range cases {

0 commit comments

Comments
 (0)