Skip to content

Commit

Permalink
Enable persistent sessions over server restart
Browse files Browse the repository at this point in the history
  • Loading branch information
onli committed Feb 14, 2020
1 parent 1dd52fb commit 4a671c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ gem 'thread'
gem 'rack-contrib'
gem 'xmlrpc'
gem 'htmlentities'
gem 'sprockets'
gem 'sprockets'
gem 'moneta'
9 changes: 9 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,14 @@ require 'bundler'

Bundler.require

# Enable persistent sessions using moneta ###
require 'moneta'
require 'rack/session/moneta'

use Rack::Session::Moneta,
expire_after: 2592000,
store: Moneta.new(:Sqlite, file: "sessions.db")


require './server.rb'
run Ursprung::Ursprung.new
1 change: 0 additions & 1 deletion server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
module Ursprung
class Ursprung < Sinatra::Application
register Sinatra::BrowserID
use Rack::Session::Pool

set :static_cache_control, [:public, max_age: 31536000]

Expand Down

0 comments on commit 4a671c1

Please sign in to comment.