-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.rb
54 lines (42 loc) · 971 Bytes
/
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
require 'rubygems'
require 'bundler'
# Load dotenv manually so it is loaded before other gems
# and all the environment variables are already available
require 'dotenv'
Dotenv.load
# Require standard library gems
require 'base64'
require 'openssl'
require 'logger'
require 'open-uri'
Bundler.require
# The main class for the kw-api
class KWApi < Sinatra::Base
enable :sessions
configure :production, :development do
enable :logging
end
configure :test do
set :logging, ::Logger::ERROR
end
configure :production do
set :haml, ugly: true
set :clean_trace, true
set :logging, ::Logger::INFO
end
configure :development do
# ...
set :logging, ::Logger::DEBUG
end
configure do
# Datamapper timezone workaround
ENV['TZ'] = 'utc'
end
helpers do
include Rack::Utils
alias_method :h, :escape_html
end
end
require_relative 'models/init'
require_relative 'helpers/init'
require_relative 'routes/init'