Class: Izanami::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/izanami/app.rb

Class Method Summary collapse

Class Method Details

.newObject

Sinatra overrides



165
166
167
# File 'lib/izanami/app.rb', line 165

def self.new(*)
  protect(super)
end

.protect(app) ⇒ Object



169
170
171
172
173
174
175
176
177
# File 'lib/izanami/app.rb', line 169

def self.protect(app)
  if ENV['IZANAMI_AUTH'].to_s.match(/disabled?/i)
    app
  else
    Rack::Auth::Basic.new(app) do |user, password|
      user == ENV['IZANAMI_USER'] && password == ENV['IZANAMI_PASSWORD']
    end
  end
end