From 650513c1146baa938c05e3b34f545868dd9a4531 Mon Sep 17 00:00:00 2001 From: Graham Ballantyne Date: Thu, 10 Oct 2013 11:14:11 -0700 Subject: [PATCH 1/2] set auth_token to a generated UUID if AUTH_TOKEN not passed in ENV --- templates/project/config.ru | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/project/config.ru b/templates/project/config.ru index 6e1076a0..08e5a5d8 100644 --- a/templates/project/config.ru +++ b/templates/project/config.ru @@ -1,7 +1,8 @@ require 'dashing' +require 'SecureRandom' configure do - set :auth_token, 'YOUR_AUTH_TOKEN' + set :auth_token, ENV['AUTH_TOKEN'] || SecureRandom.uuid helpers do def protected! From fe2170d73ac14cbb57687b66d3d1f9f2de2c847e Mon Sep 17 00:00:00 2001 From: Graham Ballantyne Date: Thu, 10 Oct 2013 11:40:10 -0700 Subject: [PATCH 2/2] downcase 'securerandom' `require 'SecureRandom'` works on my OS X dev machine, but not on my linux deploy box. `require 'securerandom'` works on both. --- templates/project/config.ru | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/project/config.ru b/templates/project/config.ru index 08e5a5d8..a509bf39 100644 --- a/templates/project/config.ru +++ b/templates/project/config.ru @@ -1,5 +1,5 @@ require 'dashing' -require 'SecureRandom' +require 'securerandom' configure do set :auth_token, ENV['AUTH_TOKEN'] || SecureRandom.uuid @@ -16,4 +16,4 @@ map Sinatra::Application.assets_prefix do run Sinatra::Application.sprockets end -run Sinatra::Application \ No newline at end of file +run Sinatra::Application