Class: Exekutor::ConfigurationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/exekutor/configuration_generator.rb

Overview

Generates a YAML configuration file

Instance Method Summary collapse

Instance Method Details

#create_configuration_fileObject

Creates the configuration file at config/exekutor.yml. Uses the current worker configuration as the base.



13
14
15
16
17
18
19
20
21
# File 'lib/generators/exekutor/configuration_generator.rb', line 13

def create_configuration_file
  config = { queues: %w[queues to watch] }.merge(Exekutor.config.worker_options)
  config[:status_port] = 12_677
  config[:set_db_connection_name] = true
  config[:wait_for_termination] = 120

  filename = "config/exekutor#{".#{options[:identifier]}" if options[:identifier]}.yml"
  create_file filename, { "exekutor" => config.stringify_keys }.to_yaml
end