-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
64 lines (56 loc) · 1.55 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
52
53
54
55
56
57
58
59
60
61
62
63
64
require 'puma'
require 'roda'
require 'slim'
require 'json'
require 'bcrypt'
require 'better_errors'
require 'logger'
require 'rack/protection'
require 'rack/csrf'
require './models'
require './env'
class Fastpress < Roda
plugin :default_headers,
'Content-Type' => 'text/html',
#'Content-Security-Policy' => "default-src 'self'",
'Strict-Transport-Security' => 'max-age=160704400',
'X-Frame-Options' => 'deny',
'X-Content-Type-Options' => 'nosniff',
'X-XSS-Protection' => '1; mode=block'
plugin :environments
plugin :multi_route
plugin :render, :engine => 'slim', :views => 'views'
plugin :static, ['/css', '/fonts', '/js']
plugin :flash
plugin :h
plugin :multi_route
use Rack::Static, :urls => {'/404' => '404.html'}, :root => 'public'
plugin :not_found do |r|
r.redirect '/404'
end
self.environment = :development
configure do
use Rack::Session::Cookie, :secret => ENV['SECRET']
use Rack::Session::Pool, :expire_after => 252000
use Rack::Protection
plugin :csrf, :raise=>true
end
configure :development do
Slim::Engine.set_options :pretty => true, :sort_attrs => true
use Rack::MethodOverride
use BetterErrors::Middleware
BetterErrors.application_root = __dir__
end
configure :production do
Slim::Engine.set_options :pretty => true, :sort_attrs => false
end
Dir['./routes/**/*.rb'].each { |f| require f }
Dir['./helpers/*.rb'].each { |f| require f }
Dir['./lib/*.rb'].each { |f| require f }
route do |r|
r.multi_route
r.root do
view 'index'
end
end
end