-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.ru
35 lines (27 loc) · 817 Bytes
/
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
require 'rubygems'
require 'bundler'
Bundler.setup
require 'rack/cors'
require_relative 'config/database'
require 'warden'
require 'omniauth'
require 'omniauth-github'
require 'grape_token_auth'
require_relative 'lib/grape_token_auth_demo'
Database.new.establish_connection!
production = ENV['RACK_ENV'] == 'production'
origin = production ? 'grape-ng-token-demo.herokuapp.com' :
'localhost:7777'
use Rack::Cors do
allow do
origins origin
resource '*', headers: :any, methods: :any,
expose: ['access-token', 'expiry', 'token-type', 'uid', 'client']
end
end
use Rack::Session::Cookie, secret: 'blah'
GrapeTokenAuth.setup_warden!(self)
use OmniAuth::Builder do
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: 'email,profile'
end
run GrapeTokenAuthDemo