File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -23,27 +23,29 @@ func (a *ReqPathRewrite) GetName() string {
23
23
}
24
24
25
25
func (a * ReqPathRewrite ) Process (k store.K8s , annotations ... map [string ]string ) (err error ) {
26
- input := common .GetValue (a .GetName (), annotations ... )
26
+ input := strings . TrimSpace ( common .GetValue (a .GetName (), annotations ... ) )
27
27
if input == "" {
28
28
return
29
29
}
30
- parts := strings .Fields (strings .TrimSpace (input ))
30
+ for _ , rule := range strings .Split (input , "\n " ) {
31
+ parts := strings .Fields (strings .TrimSpace (rule ))
31
32
32
- var rewrite * rules.ReqPathRewrite
33
- switch len (parts ) {
34
- case 1 :
35
- rewrite = & rules.ReqPathRewrite {
36
- PathMatch : "(.*)" ,
37
- PathFmt : parts [0 ],
33
+ var rewrite * rules.ReqPathRewrite
34
+ switch len (parts ) {
35
+ case 1 :
36
+ rewrite = & rules.ReqPathRewrite {
37
+ PathMatch : "(.*)" ,
38
+ PathFmt : parts [0 ],
39
+ }
40
+ case 2 :
41
+ rewrite = & rules.ReqPathRewrite {
42
+ PathMatch : parts [0 ],
43
+ PathFmt : parts [1 ],
44
+ }
45
+ default :
46
+ return fmt .Errorf ("incorrect value '%s', path-rewrite takes 1 or 2 params " , input )
38
47
}
39
- case 2 :
40
- rewrite = & rules.ReqPathRewrite {
41
- PathMatch : parts [0 ],
42
- PathFmt : parts [1 ],
43
- }
44
- default :
45
- return fmt .Errorf ("incorrect value '%s', path-rewrite takes 1 or 2 params " , input )
48
+ a .rules .Add (rewrite )
46
49
}
47
- a .rules .Add (rewrite )
48
50
return
49
51
}
You can’t perform that action at this time.
0 commit comments