Class: Karafka::Licenser

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/licenser.rb

Overview

Checks the license presence for pro and loads pro components when needed (if any)

Class Method Summary collapse

Class Method Details

.detectObject

Tries to load the license and yields if successful

[View source]

13
14
15
16
17
18
19
20
21
22
# File 'lib/karafka/licenser.rb', line 13

def detect
  # If required, do not require again
  require('karafka-license') unless const_defined?('::Karafka::License')

  yield

  true
rescue LoadError
  false
end

.prepare_and_verify(license_config) ⇒ Object

Tries to prepare license and verifies it

Parameters:

  • license_config (Karafka::Core::Configurable::Node)

    config related to the licensing

[View source]

27
28
29
30
31
32
33
# File 'lib/karafka/licenser.rb', line 27

def prepare_and_verify(license_config)
  # If license is not loaded, nothing to do
  return unless const_defined?('::Karafka::License')

  prepare(license_config)
  verify(license_config)
end