forked from getodk/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
46 lines (33 loc) · 921 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'rubygems'
require 'bundler/setup'
require 'rack'
require './server/tls_odkbuild'
require './server/warden_odkbuild'
require './server/model/connection_manager'
require './server/config_manager'
require './server/asset_manager'
require './server/odkbuild_server'
# load configuration files
ConfigManager.load
AssetManager.load
# middleware
use Rack::CommonLogger
if ConfigManager['cookie_ssl_only']
use Build::TLS
end
use Rack::Session::Cookie,
:secret => ConfigManager['cookie_secret']
use ConnectionManager
use Warden::Manager do |manager|
manager.default_strategies :odkbuild
manager.failure_app = OdkBuild
manager.serialize_into_session do |user|
user.nil? ? nil : user.username
end
manager.serialize_from_session do |id|
id.nil? ? nil : (User.find id)
end
end
use Rack::Static, :urls => [ '/stylesheets', '/javascripts', '/images' ], :root => 'public'
# app
run OdkBuild