Interface to allow alternative persistence strategy
lulalala opened this issue · comments
What do you think if we provide a common interface, so anyone can implement their own persistence strategy?
Turnout is tied too closely to the file strategy.
https://github.com/GoodGuide/maintenance-mode-gem comes into my mind. It provides the following interface:
MaintenanceMode.enable
MaintenanceMode.as_json # => { "enabled": true, "message": null }
MaintenanceMode.enable "we'll be back soon"
MaintenanceMode.as_json # => { "enabled": true, "message": "we'll be back soon" }
MaintenanceMode.enabled? # => true
MaintenanceMode.message # => "we'll be back soon"
MaintenanceMode.disable
MaintenanceMode.enabled? # => false
This would mean I can choose to indicate maintenance by flipping a switch on redis, and fetch message from the database.