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

Include option to whitelist API keys. #12

Open
oparamo opened this issue Jul 28, 2016 · 0 comments
Open

Include option to whitelist API keys. #12

oparamo opened this issue Jul 28, 2016 · 0 comments

Comments

@oparamo
Copy link

oparamo commented Jul 28, 2016

It'd be useful to have the option to whitelist certain API keys so that requests made with those keys don't get rate limited. For example, if I have some services that need to consume each other, I don't want to worry about limiting my own services.

I could pass a defaultRate function that returns an unreachable rate for requests made by my own services, but ideally I wouldn't want to go through Redis if I can identify an API key I don't want to limit.

Something like this would work I think:

options: {
    whitelist: [ 'myAPIKey', 'anotherKey' ],
}

if (options.whitelist && options.whitelist.indexOf(options.requestAPIKey(request)) > -1) {
  return reply.continue();
}

If this is something y'all would like to include in this plugin, I'd be happy to make a PR that adds this feature and the accompanying unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant