Sha256: 74d998720ddea21bfa0c7c43c0eaca53141c22481fd4f6b14140e6edcb5c910d

Contents?: true

Size: 2 KB

Versions: 15

Compression:

Stored size: 2 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_VERSION}",
          "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}",
            "License expires on: #{config.license.expires_on}"
          ]
        else
          [
            'License: LGPL-3.0'
          ]
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
karafka-2.0.0.rc5 lib/karafka/cli/info.rb
karafka-2.0.0.rc4 lib/karafka/cli/info.rb
karafka-2.0.0.rc3 lib/karafka/cli/info.rb
karafka-2.0.0.rc2 lib/karafka/cli/info.rb
karafka-2.0.0.rc1 lib/karafka/cli/info.rb
karafka-2.0.0.beta5 lib/karafka/cli/info.rb
karafka-2.0.0.beta4 lib/karafka/cli/info.rb
karafka-2.0.0.beta3 lib/karafka/cli/info.rb
karafka-2.0.0.beta2 lib/karafka/cli/info.rb
karafka-2.0.0.beta1 lib/karafka/cli/info.rb
karafka-2.0.0.alpha6 lib/karafka/cli/info.rb
karafka-2.0.0.alpha5 lib/karafka/cli/info.rb
karafka-2.0.0.alpha4 lib/karafka/cli/info.rb
karafka-2.0.0.alpha3 lib/karafka/cli/info.rb
karafka-2.0.0.alpha2 lib/karafka/cli/info.rb