imrefazekas / connect-rest

Exceptionally featureful Restful web services middleware for connect node.js
MIT License
100 stars 29 forks source link

How to update list of API keys during runtime? #20

Closed jwvanderbeck closed 10 years ago

jwvanderbeck commented 10 years ago

I want my users to be able to revoke and regenerate API keys on the fly, but it looks like the API keys are defined in connect-rest only when the module is first initialized. How would I go about changing them during runtime? Is it safe to simply call rester(options) again with new options?

imrefazekas commented 10 years ago

Hello, Right, there was no public API for the keys, thank you pointing at this missing feature!

Now, you can call the rest.apiKeys function which - without passing any parameter - simply returns the api key folder allowing you to do whatever you want to with it. Or you can pass an own array to set it directly runtime as you application requires you to use. I hope this small patch fixes your issue. If not, do not hesitate to let me know about it. :)

jwvanderbeck commented 10 years ago

Perfect thanks!