-
Notifications
You must be signed in to change notification settings - Fork 76
Extract different environments (Sinatra, Rails, ... ) #40
Comments
The names of the Gems might become:
etc. |
rack-oauth2-server is rack middleware, so it works with any Rack-compliant framework (Rails, Sinatra, etc). What would be in oauth2-sinatra that's not in oauth2-active_record? (Also, ActiveRecord is an implementation of ActiveModel for relational databases, so not sure you need a distinction between the two). Regardless, if what you're really going for is to make the gem persistence agnostic (and not just hard-wired to MongoDB), you should explore introducing the Repository pattern instead. http://blog.8thlight.com/mike-ebert/2013/03/23/the-repository-pattern.html Then you can have Repository implementations for various data stores, either as separate gems, or available in rack-oauth2-server itself, and you simply configure which persistence store you want to use. My two cents.... |
Thanks Brian! The article on the repository pattern looks very helpful indeed. About the extraction issue, my feeling was that some boilerplate could be removed when working in separate projects (i.e. Sinatra does not need Rails and vice-versa). Maybe it is just that I am new to the codebase that I don't see a simpler way to test the actual Rack middleware vs. the framework boilerplate (which are more integration tests, and maybe some extraction of the test there could help in getting closer to working at an ORM adapter) |
I discovered: https://github.com/trumant/rack-oauth2-server-active-record/commits/active_record That looks like having a separate sub-repo for AR interesting, but I need to experiment to understand better. |
Hm.. this looks like an interesting plugin for Rack too to handle storage of tokens: https://github.com/minad/moneta |
Moneta looks really interesting |
In order to make integration of different ORM setups easier (ActiveRecord, ActiveModel, Redis, .. ), a first step might be to separate the environments for Sinatra and Rails.
I did a first preparation in my fork here: https://github.com/mulderp/rack-oauth2-server/tree/extract_envs
This is a strategy that I saw here too: https://github.com/jodosha/redis-store
What do you think? This would most probably evolve into different gems too.
The text was updated successfully, but these errors were encountered: