Sha256: cdb93830c4af60519238d5a5b593464d1bfb6ebf0d2c03dba2eb72c7e9376a4f

Contents?: true

Size: 954 Bytes

Versions: 15

Compression:

Stored size: 954 Bytes

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: "1:1", desc: "min:max threads to use"
          method_option :verbose, type: :boolean, default: true, desc: "Report each request"
          def web
            port = options["port"]
            host = options["host"]
            threads = options["threads"]
            verbose = options["verbose"]

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mihari-4.11.0 lib/mihari/commands/web.rb
mihari-4.10.0 lib/mihari/commands/web.rb
mihari-4.9.0 lib/mihari/commands/web.rb
mihari-4.8.0 lib/mihari/commands/web.rb
mihari-4.7.4 lib/mihari/commands/web.rb
mihari-4.7.3 lib/mihari/commands/web.rb
mihari-4.7.2 lib/mihari/commands/web.rb
mihari-4.7.1 lib/mihari/commands/web.rb
mihari-4.7.0 lib/mihari/commands/web.rb
mihari-4.6.1 lib/mihari/commands/web.rb
mihari-4.6.0 lib/mihari/commands/web.rb
mihari-4.5.3 lib/mihari/commands/web.rb
mihari-4.5.2 lib/mihari/commands/web.rb
mihari-4.5.1 lib/mihari/commands/web.rb
mihari-4.5.0 lib/mihari/commands/web.rb