Sha256: 005e8428242aee0fb7e557dc55e45759474c9bdb6f2d921fca7bb49a92778db3

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 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:16", desc: "min:max threads to use"
          method_option :verbose, type: :boolean, default: true, desc: "Report each request"
          method_option :config, type: :string, desc: "Path to the config file"
          def web
            port = options["port"]
            host = options["host"]
            threads = options["threads"]
            verbose = options["verbose"]

            load_configuration

            # 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

7 entries across 7 versions & 1 rubygems

Version Path
mihari-3.12.0 lib/mihari/commands/web.rb
mihari-3.11.0 lib/mihari/commands/web.rb
mihari-3.10.1 lib/mihari/commands/web.rb
mihari-3.10.0 lib/mihari/commands/web.rb
mihari-3.9.2 lib/mihari/commands/web.rb
mihari-3.9.1 lib/mihari/commands/web.rb
mihari-3.9.0 lib/mihari/commands/web.rb