Sha256: 0aa97581d97740446f5df0fb1cbd47aa892ba40e21a733b672db1224da00c6b3

Contents?: true

Size: 1.94 KB

Versions: 19

Compression:

Stored size: 1.94 KB

Contents

# frozen_string_literal: true

module Karafka
  # Karafka framework Cli
  class Cli < Thor
    # Info Karafka Cli action
    class Info < Base
      desc 'Print configuration details and other options of your application'

      # Nice karafka banner
      BANNER = <<~BANNER

        @@@                                             @@@@@  @@@
        @@@                                            @@@     @@@
        @@@  @@@    @@@@@@@@@   @@@ @@@   @@@@@@@@@  @@@@@@@@  @@@  @@@@   @@@@@@@@@
        @@@@@@     @@@    @@@   @@@@@    @@@    @@@    @@@     @@@@@@@    @@@    @@@
        @@@@@@@    @@@    @@@   @@@     @@@@    @@@    @@@     @@@@@@@    @@@    @@@
        @@@  @@@@  @@@@@@@@@@   @@@      @@@@@@@@@@    @@@     @@@  @@@@   @@@@@@@@@@

      BANNER

      # Print configuration details and other options of your application
      def call
        Karafka.logger.info(BANNER)
        Karafka.logger.info((core_info + license_info).join("\n"))
      end

      private

      # @return [Array<String>] core framework related info
      def core_info
        config = Karafka::App.config

        postfix = Karafka.pro? ? ' + Pro' : ''

        [
          "Karafka version: #{Karafka::VERSION}#{postfix}",
          "Ruby version: #{RUBY_DESCRIPTION}",
          "Rdkafka version: #{::Rdkafka::VERSION}",
          "Subscription groups count: #{Karafka::App.subscription_groups.size}",
          "Workers count: #{Karafka::App.config.concurrency}",
          "Application client id: #{config.client_id}",
          "Boot file: #{Karafka.boot_file}",
          "Environment: #{Karafka.env}"
        ]
      end

      # @return [Array<String>] license related info
      def license_info
        config = Karafka::App.config

        if Karafka.pro?
          [
            'License: Commercial',
            "License entity: #{config.license.entity}"
          ]
        else
          [
            'License: LGPL-3.0'
          ]
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
karafka-2.0.21 lib/karafka/cli/info.rb
karafka-2.0.20 lib/karafka/cli/info.rb
karafka-2.0.19 lib/karafka/cli/info.rb
karafka-2.0.18 lib/karafka/cli/info.rb
karafka-2.0.17 lib/karafka/cli/info.rb
karafka-2.0.16 lib/karafka/cli/info.rb
karafka-2.0.15 lib/karafka/cli/info.rb
karafka-2.0.14 lib/karafka/cli/info.rb
karafka-2.0.13 lib/karafka/cli/info.rb
karafka-2.0.12 lib/karafka/cli/info.rb
karafka-2.0.11 lib/karafka/cli/info.rb
karafka-2.0.10 lib/karafka/cli/info.rb
karafka-2.0.9 lib/karafka/cli/info.rb
karafka-2.0.8 lib/karafka/cli/info.rb
karafka-2.0.7 lib/karafka/cli/info.rb
karafka-2.0.6 lib/karafka/cli/info.rb
karafka-2.0.5 lib/karafka/cli/info.rb
karafka-2.0.4 lib/karafka/cli/info.rb
karafka-2.0.3 lib/karafka/cli/info.rb