25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/racecar/cli.rb', line 25
def run
$stderr.puts "=> Starting Racecar consumer #{consumer_name}..."
RailsConfigFileLoader.load! unless config.without_rails?
if File.exist?("config/racecar.rb")
require "./config/racecar"
end
consumer_class = Kernel.const_get(consumer_name)
config.load_consumer_class(consumer_class)
config.validate!
if config.logfile
$stderr.puts "=> Logging to #{config.logfile}"
Racecar.logger = Logger.new(config.logfile)
end
if config.log_level
Racecar.logger.level = Object.const_get("Logger::#{config.log_level.upcase}")
end
if config.datadog_enabled
configure_datadog
end
$stderr.puts "=> Wrooooom!"
if config.daemonize
daemonize!
else
$stderr.puts "=> Ctrl-C to shutdown consumer"
end
if config.liveness_probe_enabled
$stderr.puts "=> Liveness probe enabled"
config.install_liveness_probe
end
processor = consumer_class.new
@runner = Racecar.runner(processor)
@runner.run
nil
end
|