Sha256: fb274ebe7bf34c9204dfb6e283c0e7437d0e0933bf44359df45542fb29a71fe2

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

$LOAD_PATH <<::File.expand_path('../lib/', __FILE__)

require 'local_pac'

LocalPac.config.debug_mode = true if ENV['DEBUG']
LocalPac.config.log_level = ENV['LOG_LEVEL'] if ENV['LOG_LEVEL']
LocalPac.config.access_log = ENV['ACCESS_LOG'] if ENV['ACCESS_LOG']

LocalPac.ui_logger.level = LocalPac.config.log_level

require File.expand_path('../app/controllers/application_controller.rb', __FILE__)
Dir.glob(::File.expand_path('../app/controllers/*.rb', __FILE__)).each { |f| require f }


trap LocalPac.config.reload_config_signal do
  begin
    LocalPac.ui_logger.warn 'Reload of configuration requested'
    LocalPac::Actions::ReloadConfiguration.new.run
    LocalPac.ui_logger.info 'Reload of configuration successful'
  rescue Exceptions::ReloadOfLocalStorageFailed => e
    LocalPac.ui_logger.fatal "Reload of configuration failed: #{e.message}"
  end
end

trap LocalPac.config.reload_storage_signal do
  begin
    LocalPac.ui_logger.warn 'Reload of local storage requested'
    LocalPac::Actions::ReloadLocalStorage.new([LocalPac::App::FileServeController, LocalPac::App::LookupController]).run
    LocalPac.ui_logger.info 'Reload of local storage successful'
  rescue Exceptions::ReloadOfLocalStorageFailed => e
    LocalPac.ui_logger.fatal "Reload of local storage failed: #{e.message}"
  end
end

map '/' do
  run LocalPac::App::FileServeController
end

map '/v1/pac/' do
  run LocalPac::App::FileServeController
end

map '/v1/lookup/' do
  run LocalPac::App::LookupController
end

map '/v1/git_hook/' do
  run LocalPac::App::GitHookController
end

map LocalPac::App::AssetsController.assets_prefix do
  run LocalPac::App::AssetsController.assets
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
local_pac-0.7.0 config.ru
local_pac-0.6.3 config.ru
local_pac-0.6.2 config.ru
local_pac-0.6.1 config.ru