-
Notifications
You must be signed in to change notification settings - Fork 170
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
Extract MappingRule from Configuration #571
Conversation
system_name = proxy_rule.metric_system_name or error('missing metric name of rule ' .. inspect(proxy_rule)), | ||
delta = proxy_rule.delta | ||
} | ||
return mapping_rule.from_proxy_rule(proxy_rule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be further simplified to map(mapping_rule.from_proxy_rule, proxy.proxy_rules or empty)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
gateway/src/apicast/mapping_rule.lua
Outdated
return match | ||
end | ||
|
||
function _M.new(http_method, pattern, params, querystring_params, metric, delta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep this method private because there is high chance the initializer will change with that many params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Let's wait until we bring more functionality from Service
.
@davidor definitely agree! This is a good path to split the configuration.lua. The |
6cf6e0d
to
3d7f33e
Compare
There were many local methods in `Configuration` that were related only to mapping rules, so I think that this change makes sense. I think that some of the code from `Service` should also be in this new module, but let's go step by step.
3d7f33e
to
029e910
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Minor refactoring.
This PR extracts MappingRule from Configuration. There were many local methods in
Configuration
that were related only to mapping rules, so I think this makes sense.Just to be clear, there are no changes in the implementation nor the test coverage.
I think that some of the code from
Service
should also be in this new module, but let's go step by step.Let me know what you think @mikz . If you agree I'll add some documentation for the public methods.