Sha256: 09a922c65acbe3dd7054a4cc6fe4ae9f07d35d087a9ff728f1ec03c98e61ea8a
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
# encoding: utf-8 module LocalPac @config_semaphore = Mutex.new @logger_semaphore = Mutex.new @routing_semaphore = Mutex.new class << self attr_reader :config_semaphore attr_reader :logger_semaphore attr_reader :routing_semaphore attr_accessor :debug_mode def config config_semaphore.synchronize do @config ||= LocalPac::Config.new end end def config=(config) @config = config end def ui_logger(local_logger = LocalPac::UiLogger.new) logger_semaphore.synchronize do @ui_logger ||= local_logger end end def error_id SecureRandom.hex end def routing routing_semaphore.synchronize do @routing ||= Rack::Builder.new do require_relative ::File.expand_path('../../../app/controllers/application_controller.rb', __FILE__) Dir.glob(::File.expand_path('../../../app/controllers/*.rb', __FILE__)).each { |f| require_relative f } 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 LocalPac::App::ApplicationController.assets_prefix do run LocalPac::App::ApplicationController.assets end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems