Class: Madness::ServerBase

Inherits:
Sinatra::Application
  • Object
show all
Extended by:
ServerHelper
Defined in:
lib/madness/server_base.rb

Overview

The base class for the sinatra server. Initialize what we can here, but since there are values that will become known only later, the #prepare method is provided.

Direct Known Subclasses

Server

Class Method Summary collapse

Methods included from ServerHelper

config, disallowed_static?, docroot, find_static_file, log, theme

Class Method Details

.prepareObject



26
27
28
29
30
31
32
# File 'lib/madness/server_base.rb', line 26

def prepare
  set :bind, config.bind
  set :port, config.port
  set :views, theme.views_path

  set_basic_auth if config.auth
end

.set_basic_authObject



34
35
36
37
38
# File 'lib/madness/server_base.rb', line 34

def set_basic_auth
  use Rack::Auth::Basic, config.auth_zone do |username, password|
    config.auth.split(':') == [username, password]
  end
end