Module: Mihari::Commands::Sidekiq

Included in:
Mihari::CLI::App
Defined in:
lib/mihari/commands/sidekiq.rb

Overview

Sidekiq sub-commands

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mihari/commands/sidekiq.rb', line 10

def included(thor)
  thor.class_eval do
    desc "sidekiq", "Start Sidekiq"
    method_option :env, type: :string, default: "production", desc: "Environment"
    method_option :concurrency, type: :numeric, default: 5, desc: "Sidekiq concurrency", aliases: "-c"
    def sidekiq
      require "sidekiq/cli"

      ENV["APP_ENV"] ||= options["env"]
      concurrency = options["concurrency"].to_s

      cli = ::Sidekiq::CLI.instance
      cli.parse ["-r", File.expand_path(File.join(__dir__, "..", "sidekiq", "application.rb")), "-c",
        concurrency]
      cli.run
    end
  end
end