forked from chillu/github-dashing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
77 lines (65 loc) · 1.85 KB
/
config.ru
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
65
66
67
68
69
70
71
72
73
74
75
76
77
require 'dashing'
require 'faraday'
require 'faraday/http_cache'
require 'time'
require 'yaml'
require 'dotenv'
require 'time'
require 'active_support/core_ext'
require 'raven'
require 'json'
require 'typhoeus'
require 'typhoeus/adapters/faraday'
if ENV['DOTENV_FILE']
Dotenv.load ENV['DOTENV_FILE']
else
Dotenv.load
end
use Raven::Rack
Raven.configure do |config|
if ENV['SENTRY_DSN']
# TODO Fix "undefined method `send_in_current_environment?'" and disable for dev
config.environments = %w[ production development ]
else
config.environments = []
end
end
# Persist on disk, don't exceed heroku memory limit
stack = Faraday::RackBuilder.new do |builder|
store = ActiveSupport::Cache.lookup_store(:file_store, [Dir.pwd + '/tmp'])
logger = Logger.new(STDOUT)
logger.level = Logger::DEBUG unless ENV['RACK_ENV'] == 'production'
builder.use :http_cache, store: store, logger: logger, shared_cache: false, serializer: Marshal
builder.use Octokit::Response::RaiseError
builder.adapter :typhoeus
end
Octokit.middleware = stack
# Verbose logging in Octokit
Octokit.configure do |config|
config.middleware.response :logger unless ENV['RACK_ENV'] == 'production'
end
Octokit.auto_paginate = true
ENV['SINCE'] ||= '12.months.ago.beginning_of_month'
ENV['SINCE'] = ENV['SINCE'].to_datetime.to_s rescue eval(ENV['SINCE']).to_s
configure do
set :auth_token, 'YOUR_AUTH_TOKEN'
set :environment, ENV['RACK_ENV']
disable :protection
helpers do
def protected!
# Put any authentication code you want in here.
# This method is run before accessing any resource.
end
end
end
# class NoCompression
# def compress(string)
# # do nothing
# string
# end
# end
# Sinatra::Application.sprockets.js_compressor = NoCompression.new
map Sinatra::Application.assets_prefix do
run Sinatra::Application.sprockets
end
run Sinatra::Application