-
Notifications
You must be signed in to change notification settings - Fork 91
/
app.rb
47 lines (39 loc) · 1.23 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
require 'bundler'
Bundler.require
# setup environment variables
require 'dotenv'
Dotenv.load
# setup load paths
$: << File.expand_path('../', __FILE__)
$: << File.expand_path('../lib', __FILE__)
require 'sinatra/base'
require 'sinatra/assets_extension'
require 'sinatra/error_logging_extension'
module Citygram
class App < Sinatra::Base
register Sinatra::AssetsExtension
register Sinatra::ErrorLoggingExtension
configure do
set :application_url, ENV.fetch('APPLICATION_URL')
set :root, File.expand_path('../', __FILE__)
set :logger, Logger.new(test? ? nil : STDOUT)
set :map_id, ENV.fetch('MAP_ID') { 'codeforamerica.inb9loae' }
set :views, 'app/views'
set :erb, escape_html: true,
layout_options: { views: 'app/views/layouts' }
end
configure :production do
require 'newrelic_rpm'
require 'rack/ssl'
use Rack::SSL unless ENV['NO_SSL'] == 'true'
end
end
end
require 'app/models'
require 'app/routes'
require 'app/workers'
# Log instrumented requests for publisher and subscription connections
ActiveSupport::Notifications.subscribe(
/^request\.(publisher|subscription)\./,
Citygram::Services::ConnectionBuilder::RequestLog.new(Citygram::App.logger)
)