virto-network / valor

Create HTTP APIs with a plugin system that runs in the server and the browser.
GNU General Public License v3.0
9 stars 8 forks source link

Allow configuring plugins #8

Closed olanod closed 3 years ago

olanod commented 3 years ago

Currently a plugin is only a function that handles a request. Plugins should be allowed to hold some state that is initialized at registration time.

olanod commented 3 years ago

Thinking out loud ... we could introduce a new method to the RequestHandler(is it still a good name?) trait that constructs and returns the handler(init, new, etc.)(does this break the trait object constraint?), it could have a default implementation, maybe also add the Default trait bound? Open to better suggestions!

olanod commented 3 years ago

Now thinking, allowing users to use environment variables directly as a way to configure their plugins should be just fine, still some things to consider