Skip to content

Commit

Permalink
fix: delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina committed Jul 4, 2024
1 parent 2bf4cdf commit 9c4df98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/proxy/attribute/attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type Attribute struct {
}

func ComposeAttribute(attribute string, attrs map[string]interface{}) string {
if strings.Contains(attribute, "{") {
template := fasttemplate.New(attribute, "{", "}")
if strings.Contains(attribute, "${") {
template := fasttemplate.New(attribute, "${", "}")
return template.ExecuteString(attrs)
}
return attribute
Expand Down
6 changes: 3 additions & 3 deletions test/e2e_test/testbench/testdata/configs/rules/rule.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rules:
- backends:
- name: entropy
target: "http://localhost:58420"
target: "http://localhost:56945"
frontends:
- name: ping
path: "/api/ping"
Expand Down Expand Up @@ -181,7 +181,7 @@ rules:
action: authz_action
attributes:
resource:
value: '{project}-{name}'
value: ${project}-${name}
type: composite
project:
key: project
Expand Down Expand Up @@ -216,4 +216,4 @@ rules:
permissions:
- name: owner
namespace: entropy/firehose
attribute: '{project}-{name}'
attribute: ${project}-${name}
4 changes: 2 additions & 2 deletions test/e2e_test/testbench/testdata/configs/rules/rule.yamltpl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ rules:
action: authz_action
attributes:
resource:
value: '{project}-{name}'
value: ${project}-${name}
type: composite
project:
key: project
Expand Down Expand Up @@ -216,4 +216,4 @@ rules:
permissions:
- name: owner
namespace: entropy/firehose
attribute: '{project}-{name}'
attribute: ${project}-${name}

0 comments on commit 9c4df98

Please sign in to comment.