Skip to content

Commit

Permalink
Force SSL with rack-ssl-enforcer (heroku#113)
Browse files Browse the repository at this point in the history
* Add rack-ssl-enforcer

* Use config var to conditionally force SSL
  • Loading branch information
Max Beizer authored Aug 17, 2016
1 parent 1ad6d72 commit beec674
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.rvmrc
.bundle
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ gem 'sinatra'
gem 'thin'
gem 'maruku'
gem 'i18n'
gem 'rack-ssl-enforcer'
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GEM
rack (1.6.4)
rack-protection (1.5.3)
rack
rack-ssl-enforcer (0.2.9)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
Expand All @@ -24,11 +25,12 @@ PLATFORMS
DEPENDENCIES
i18n
maruku
rack-ssl-enforcer
sinatra
thin

RUBY VERSION
ruby 2.3.1p112

BUNDLED WITH
1.12.4
1.12.5
2 changes: 2 additions & 0 deletions web.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'sinatra'
require 'maruku'
require 'i18n'
require 'rack/ssl-enforcer'

configure do
use Rack::SslEnforcer if ENV['FORCE_SSL']
I18n.enforce_available_locales = true
I18n.load_path = Dir[File.join(settings.root, 'locales', '*.yml')]
I18n.backend.load_translations
Expand Down

0 comments on commit beec674

Please sign in to comment.