Skip to content

Conversation

@tylitianrui
Copy link
Contributor

@tylitianrui tylitianrui commented Apr 11, 2022

Description

  • check the type of plugin.init whether it is function or not. plugin.init may be defined as other data types
    in custom plugins
  • remove redundant code

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@tylitianrui tylitianrui changed the title check plugin init type feat: check plugin init type Apr 11, 2022
@tokers
Copy link
Contributor

tokers commented Apr 12, 2022

@tylitianrui The issue link is broken, could you fix it?

if plugin.init then
plugin.init()
if type(plugin.init) == "function" then
plugin.init()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

check type of plugin.init. customer plugin may define it as other data types

Copy link
Member

Choose a reason for hiding this comment

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

We can add it in

if not plugin.priority then
and reject invalid plugin

@tzssangglass
Copy link
Member

tzssangglass commented Apr 20, 2022

plugin.init may be defined as other data types in custom plugins

Frankly, I don't think it makes sense.

If init needs to be checked, then rewrite, access, etc. all need to be checked.

@github-actions
Copy link

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 20, 2022
@github-actions
Copy link

This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants