-
Notifications
You must be signed in to change notification settings - Fork 16
/
app.rb
51 lines (37 loc) · 1.09 KB
/
app.rb
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
46
47
48
49
50
51
require File.expand_path("shotgun", File.dirname(__FILE__))
require File.expand_path("settings", File.dirname(__FILE__))
Cuba.plugin Cuba::Mote
Cuba.plugin Shield::Helpers
Cuba.use Rack::MethodOverride
Cuba.use Rack::Session::Cookie,
key: "__insert app name__",
secret: "__insert secret here__"
Cuba.use Rack::Static,
root: "public",
urls: ["/js", "/css", "/less", "/img"]
Cuba.use Rack::Protection
Cuba.use Rack::Protection::RemoteReferrer
# Configure your default setting in env.sh by overriding MALONE_URL.
Malone.connect(url: Settings::MALONE_URL)
# Configure your redis settings in env.sh. We're connecting to DB 15.
Ohm.connect(url: Settings::REDIS_URL)
Dir["./lib/**/*.rb"].each { |rb| require rb }
Dir["./models/**/*.rb"].each { |rb| require rb }
Dir["./routes/**/*.rb"].each { |rb| require rb }
# we mix in lib/helpers.rb into Cuba.
Cuba.plugin Helpers
Cuba.define do
persist_session!
on root do
res.write view("home", title: "My Site Home")
end
on authenticated(User) do
run Users
end
on "admin" do
run Admins
end
on default do
run Guests
end
end