Class: Karafka::Setup::Config
- Inherits:
-
Object
- Object
- Karafka::Setup::Config
- Extended by:
- Dry::Configurable
- Defined in:
- lib/karafka/setup/config.rb
Overview
If you want to do some configurations after all of this is done, please add to karafka/config a proper file (needs to inherit from Karafka::Setup::Configurators::Base and implement setup method) after that everything will happen automatically
This config object allows to create a 1 level nestings (nodes) only. This should be enough and will still keep the code simple
Configurator for setting up all the framework details that are required to make it work
Class Method Summary collapse
-
.setup {|Karafka| ... } ⇒ Object
Configurating method.
-
.setup_components ⇒ Object
Everything that should be initialized after the setup Components are in karafka/config directory and are all loaded one by one If you want to configure a next component, please add a proper file to config dir.
-
.validate! ⇒ Boolean
Validate config based on ConfigurationSchema.
Class Method Details
.setup {|Karafka| ... } ⇒ Object
Configurating method
136 137 138 139 140 |
# File 'lib/karafka/setup/config.rb', line 136 def setup configure do |config| yield(config) end end |
.setup_components ⇒ Object
Everything that should be initialized after the setup Components are in karafka/config directory and are all loaded one by one If you want to configure a next component, please add a proper file to config dir
145 146 147 148 149 |
# File 'lib/karafka/setup/config.rb', line 145 def setup_components Configurators::Base.descendants.each do |klass| klass.new(config).setup end end |
.validate! ⇒ Boolean
Validate config based on ConfigurationSchema
155 156 157 158 159 160 161 |
# File 'lib/karafka/setup/config.rb', line 155 def validate! validation_result = Karafka::Schemas::Config.call(config.to_h) return true if validation_result.success? raise Errors::InvalidConfiguration, validation_result.errors end |