File: rainbows.rb

package info (click to toggle)
ruby-sinatra 3.0.5-3%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,944 kB
  • sloc: ruby: 17,305; makefile: 7
file content (22 lines) | stat: -rw-r--r-- 506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'rainbows'

module Rack
  module Handler
    class Rainbows
      def self.run(app, **options)
        rainbows_options = {
          listeners: ["#{options[:Host]}:#{options[:Port]}"],
          worker_processes: 1,
          timeout: 30,
          config_file: ::File.expand_path('rainbows.conf', __dir__)
        }

        ::Rainbows::HttpServer.new(app, rainbows_options).start.join
      end
    end

    register :rainbows, ::Rack::Handler::Rainbows
  end
end