-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
45 lines (36 loc) · 841 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
require 'rubygems'
require 'sinatra'
require 'sass'
require 'coffee_script'
configure :development do
require 'newrelic_rpm'
require 'new_relic/rack/developer_mode'
use NewRelic::Rack::DeveloperMode
end
configure :staging do
use Rack::Auth::Basic do |username, password|
username == ENV['BASIC_AUTH_USERNAME'] && password == ENV['BASIC_AUTH_PASSWORD']
end
end
configure :production do
require 'newrelic_rpm'
end
get '/' do
erb :index
end
# assets
get '/css/application.css' do
scss :application
end
get '/js/application.js' do
coffee erb(:"application.coffee", :layout => false)
end
not_found do
erb :not_found
end
helpers do
def pusher_api_key
ENV["RACK_ENV"] == "development" ? ENV["PUSHER_KEY"] : URI.parse(ENV["PUSHER_URL"]).user
end
end
use Rack::Static, :urls => ["/images"], :root => "public"