lib/tailog.rb in tailog-0.1.2 vs lib/tailog.rb in tailog-0.1.3

- old
+ new

@@ -24,17 +24,24 @@ module Tailog class << self attr_accessor :log_path + attr_accessor :basic_auth end self.log_path = File.expand_path("log", Dir.pwd) + self.basic_auth = proc do |username, password| + username == (ENV['TAILOG_USERNAME'] || 'tailog') and + password == (ENV['TAILOG_USERNAME'] || 'password') + end class App < Sinatra::Base set :root, File.expand_path("../../app", __FILE__) set :public_folder do "#{root}/assets" end set :views do "#{root}/views" end + + use Rack::Auth::Basic, "Restricted Area", &Tailog.basic_auth helpers do def h(text) Rack::Utils.escape_html(text) end