From 43b860f64a89c4bebaf1d42bf573ef421b5b5e0c Mon Sep 17 00:00:00 2001 From: Devin Bayer Date: Wed, 2 Oct 2013 10:53:44 +0200 Subject: [PATCH] support noauth --- .env.example | 2 +- config.ru | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index ba8b9aa..d995df1 100644 --- a/.env.example +++ b/.env.example @@ -16,7 +16,7 @@ #USE_SVG=false #API_TOKEN=changeme -# OAuth type (either 'google' or 'github') +# OAuth type (either 'google', 'github', or 'noauth') #OAUTH_PROVIDER=google # Google OpenID diff --git a/config.ru b/config.ru index 93459f3..e4af488 100644 --- a/config.ru +++ b/config.ru @@ -22,7 +22,15 @@ use OmniAuth::Builder do :domain => ENV['GOOGLE_OAUTH_DOMAIN'] end -run Rack::URLMap.new('/' => Descartes::Web, '/auth/github' => Descartes::GithubAuth) +class Descartes::NoAuth < Sinatra::Base + before do + session['user'] = { 'uid' => 'anonymous', 'email' => 'noemail' } + redirect '/' + end +end + +run Rack::URLMap.new('/' => Descartes::Web, '/auth/github' => Descartes::GithubAuth, + '/auth/noauth' => Descartes::NoAuth) # seed our Metrics list at startup Metric.load unless ENV['METRICS_UPDATE_ON_BOOT'] == 'false'