mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +00:00
26 lines
656 B
Ruby
26 lines
656 B
Ruby
require 'rswag/ui/middleware'
|
|
require 'rswag/ui/basic_auth'
|
|
|
|
module Rswag
|
|
module Ui
|
|
class Engine < ::Rails::Engine
|
|
isolate_namespace Rswag::Ui
|
|
|
|
initializer 'rswag-ui.initialize' do |app|
|
|
middleware.use Rswag::Ui::Middleware, Rswag::Ui.config
|
|
|
|
if Rswag::Ui.config.basic_auth_enabled
|
|
c = Rswag::Ui.config
|
|
app.middleware.use Rswag::Ui::BasicAuth do |username, password|
|
|
c.config_object[:basic_auth].values == [username, password]
|
|
end
|
|
end
|
|
end
|
|
|
|
rake_tasks do
|
|
load File.expand_path('../../../tasks/rswag-ui_tasks.rake', __FILE__)
|
|
end
|
|
end
|
|
end
|
|
end
|