Object
Load the specified rackup file, pull an options from the rackup file, and set @app.
# File lib/puma/configuration.rb, line 50 def app if app = @options[:app] return app end path = @options[:rackup] || DefaultRackup unless File.exists?(path) raise "Missing rackup file '#{path}'" end app, options = Rack::Builder.parse_file path @options.merge! options options.each do |key,val| if key.to_s[0,4] == "bind" @options[:binds] << val end end unless @options[:quiet] app = Rack::CommonLogger.new(app, STDOUT) end return app end
# File lib/puma/configuration.rb, line 16 def initialize_copy(other) @options = @options.dup end
# File lib/puma/configuration.rb, line 20 def load if path = @options[:config_file] DSL.new(@options)._load_from path end # Rakeup default option support if host = @options[:Host] port = @options[:Port] || DefaultTCPPort @options[:binds] << "tcp://#{host}:#{port}" end if @options[:binds].empty? @options[:binds] << "tcp://#{DefaultTCPHost}:#{DefaultTCPPort}" end if @options[:control_url] == "auto" path = Configuration.temp_path @options[:control_url] = "unix://#{path}" @options[:control_url_temp] = path end unless @options[:control_auth_token] setup_random_token end end
# File lib/puma/configuration.rb, line 77 def setup_random_token begin require 'openssl' rescue LoadError end count = 16 bytes = nil if defined? OpenSSL::Random bytes = OpenSSL::Random.random_bytes(count) elsif File.exists?("/dev/urandom") File.open("/dev/urandom") do |f| bytes = f.read(count) end end if bytes token = "" bytes.each_byte { |b| token << b.to_s(16) } else token = (0..count).to_a.map { rand(255).to_s(16) }.join end @options[:control_auth_token] = token end
Generated with the Darkfish Rdoc Generator 2.