Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repository_memory: Add rule id to malformed configuration error #386

Merged
merged 2 commits into from
Mar 25, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rule/repository_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (m *RepositoryMemory) Set(ctx context.Context, rules []Rule) error {
for _, check := range rules {
if err := m.r.RuleValidator().Validate(&check); err != nil {
viperx.LoggerWithValidationErrorFields(m.r.Logger(), err).WithError(err).
Errorf("A rule uses a malformed configuration and all URLs matching this rule will not work. You should resolve this issue now.")
Errorf("Rule %s uses a malformed configuration and all URLs matching this rule will not work. You should resolve this issue now.", check.ID)
Copy link
Member

@aeneasr aeneasr Mar 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can actually include the full rule here :)

Suggested change
Errorf("Rule %s uses a malformed configuration and all URLs matching this rule will not work. You should resolve this issue now.", check.ID)
WithField("rule_id", check.ID).
WithField("rule", check).
Error("A rule uses a malformed configuration and all URLs matching this rule will not work. You should resolve this issue now.")

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good in the code, but it will print out bytes.

ERRO[0000] Rule chatbot-webhook uses a malformed configuration and all URLs matching this rule will not work. You should resolve this issue now. error="authenticator matching this route is misconfigured or disabled" rule="{chatbot-webhook 0xc0004c20c0 [{oauth2_client_credentials []}] {keto_engine_acp_ory [123 10 32 32 32 32 32 32 32 32 34 114 101 113 117 105 114 101 100 95 97 99 116 105 111 110 34 58 32 34 99 97 108 108 34 44 10 32 32 32 32 32 32 32 32 34 114 101 113 117 105 114 101 100 95 114 101 115 111 117 114 99 101 34 58 32 34 99 104 97 116 98 111 116 58 119 101 98 104 111 111 107 34 10 32 32 32 32 32 32 125]} [{noop []}] [] {false } <nil>}" rule_id=chatbot-webhook
Maybe just the rule_id field then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense!

}
}

Expand Down