Skip to content
Browse files

Add basic auth in production

  • Loading branch information...
1 parent a681877 commit 81f11a6917b2838bc3454b33507720a8b356929d @brianjlandau brianjlandau committed Jan 14, 2011
Showing with 7 additions and 0 deletions.
  1. +2 −0 config/settings.example.yml
  2. +5 −0 init.rb
View
2 config/settings.example.yml
@@ -2,6 +2,8 @@ defaults: &defaults
:log_level: warn
:monit_bin_dir: "/usr/local/bin"
:monit_cli_options: "-d 60 -c /path/to/monitrc"
+ :http_auth_username: admin
+ :http_auth_password: password
:development:
<<: *defaults
View
5 init.rb
@@ -21,6 +21,11 @@
class Main < Monk::Glue
set :app_file, __FILE__
use Rack::Session::Cookie
+ if RACK_ENV.to_sym == :production
+ use Rack::Auth::Basic do |username, password|
+ username == monk_settings(:http_auth_username) && password == monk_settings(:http_auth_password)
+ end
+ end
register Mustache::Sinatra
set :views, root_path('app', 'templates')
set :mustache, {

0 comments on commit 81f11a6

Please sign in to comment.
Something went wrong with that request. Please try again.