Sha256: 20b2bba45cd2bed56cff33c81933bc64d14966e2e1c6f7eef165bbe0e38002d6

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Mihari
  module Commands
    module Web
      def self.included(thor)
        thor.class_eval do
          desc "web", "Launch the web app"
          method_option :port, type: :numeric, default: 9292, desc: "Hostname to listen on"
          method_option :host, type: :string, default: "localhost", desc: "Port to listen on"
          method_option :threads, type: :string, default: "0:5", desc: "min:max threads to use"
          method_option :verbose, type: :boolean, default: true, desc: "Report each request"
          method_option :worker_timeout, type: :numeric, default: 60, desc: "Worker timeout value (in seconds)"
          def web
            port = options["port"]
            host = options["host"]
            threads = options["threads"]
            verbose = options["verbose"]
            worker_timeout = options["worker_timeout"]

            # set rack env as production
            ENV["RACK_ENV"] ||= "production"

            Mihari::App.run!(port: port, host: host, threads: threads, verbose: verbose, worker_timeout: worker_timeout)
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mihari-5.1.4 lib/mihari/commands/web.rb
mihari-5.1.3 lib/mihari/commands/web.rb
mihari-5.1.2 lib/mihari/commands/web.rb
mihari-5.1.1 lib/mihari/commands/web.rb
mihari-5.1.0 lib/mihari/commands/web.rb
mihari-5.0.1 lib/mihari/commands/web.rb
mihari-5.0.0 lib/mihari/commands/web.rb
mihari-4.12.0 lib/mihari/commands/web.rb