KMarshland / heroku-ssl

Quickly and easily add SSL to Rails applications
MIT License
84 stars 0 forks source link

Use Postgres instead of Redis #4

Open toobulkeh opened 7 years ago

toobulkeh commented 7 years ago

Many rails apps use Postgres as a default database. Would the functionality you're gaining from redis be possible with a properly namespaced table in an existing database configured by the app with DATABASE_URL (Heroku default)?

KMarshland commented 7 years ago

It would certainly be possible -- all we really need is a key-value store. However, I think that redis is a much better fit for this sort of task. That said, I would certainly accept a PR that lets you use postgres optionally. I'm envisioning something along the lines of an initializer

HerokuSsl::configure do |config|
   config.use_postgres = true

   # other potential options
   # config.redis_url = '...'
   # config.redis_connection = lambda { 'your code here' }
   # config.set_key = lambda { |key, value| 'you could have whatever way of storing a key value pair here' }
   # config.get_key = lambda { |key| 'you could have whatever way of retrieving a key value pair here' }
end