Sha256: e0389642fe70bd6bb6ffa70d1bc219a26e856f3c3f6b61977d05b5a54391f1fd

Contents?: true

Size: 955 Bytes

Versions: 8

Compression:

Stored size: 955 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: "0:16", 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

8 entries across 8 versions & 1 rubygems

Version Path
mihari-4.4.1 lib/mihari/commands/web.rb
mihari-4.4.0 lib/mihari/commands/web.rb
mihari-4.3.0 lib/mihari/commands/web.rb
mihari-4.2.0 lib/mihari/commands/web.rb
mihari-4.1.2 lib/mihari/commands/web.rb
mihari-4.1.1 lib/mihari/commands/web.rb
mihari-4.1.0 lib/mihari/commands/web.rb
mihari-4.0.0 lib/mihari/commands/web.rb