Class: Karafka::Web::Pro::Loader
- Inherits:
-
Object
- Object
- Karafka::Web::Pro::Loader
- Defined in:
- lib/karafka/web/pro/loader.rb
Overview
Loader requires and loads all the pro components only when they are needed
Class Method Summary collapse
-
.load_on_late_setup ⇒ Object
This loads the pro components into memory in case someone required karafka-web prior to the license usage.
-
.post_setup_all(config) ⇒ Object
Runs post setup features configuration operations.
-
.pre_setup_all(config) ⇒ Object
Loads all the Web UI pro components and configures them wherever it is expected.
Class Method Details
.load_on_late_setup ⇒ Object
This loads the pro components into memory in case someone required karafka-web prior to the license usage. This can happen for users with complex require flows, where Karafka license is not part of the standard flow
In such cases Web may not notice that Karafka should operate in a Pro mode when it is being required via Zeitwerk. In such cases we load Pro components prior to the setup.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/karafka/web/pro/loader.rb', line 26 def load_on_late_setup return if defined?(Karafka::Web::Pro::Commanding) loader = Zeitwerk::Loader.new loader.push_dir( File.join(Karafka::Web.gem_root, 'lib/karafka/web/pro'), namespace: Karafka::Web::Pro ) loader.setup loader.eager_load end |
.post_setup_all(config) ⇒ Object
Runs post setup features configuration operations
59 60 61 62 63 64 |
# File 'lib/karafka/web/pro/loader.rb', line 59 def post_setup_all(config) Commanding.post_setup(config) Ui::Lib::Branding.post_setup(config) Ui::Lib::Policies.post_setup(config) Ui::Lib::Search.post_setup(config) end |
.pre_setup_all(config) ⇒ Object
Loads all the Web UI pro components and configures them wherever it is expected
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/karafka/web/pro/loader.rb', line 42 def pre_setup_all(config) # Expand the config with commanding configuration config.instance_eval do setting(:commanding, default: Commanding::Config.config) end # Expand UI config with extra search capabilities settings config.ui.instance_eval do setting(:branding, default: Ui::Lib::Branding::Config.config) setting(:policies, default: Ui::Lib::Policies::Config.config) setting(:search, default: Ui::Lib::Search::Config.config) end end |