This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.rb
More file actions
57 lines (43 loc) · 1.36 KB
/
app.rb
File metadata and controls
57 lines (43 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
# rubocop:disable Style/FrozenStringLiteralComment
ENV['RACK_ENV'] ||= 'development'
ENV['KARAFKA_ENV'] ||= ENV['RACK_ENV']
require 'active_support'
require 'active_support/core_ext'
require 'singleton'
require 'sentry-raven'
Bundler.require(:default, ENV['KARAFKA_ENV'])
Dir['./app/**/*.rb'].sort.each(&method(:require))
Dir['./lib/**/*.rb'].sort.each(&method(:require))
require './config/database_bootstrap'
Karafka::Loader.new.load(Karafka::App.root)
# Only spit errors in production
Raven.configure do |config|
config.environments = %w(production)
end
# App class
class App < Karafka::App
setup do |config|
config.kafka.hosts = ENV.fetch('KAFKA_HOSTS', '').split(',')
config.name = 'talkbirdy-myna'
config.redis = { url: case ENV['KARAFKA_ENV']
when /production/
ENV['REDIS_URL']
else
'redis://localhost:6379'
end }
config.inline_mode = false
end
routes.draw do
topic :sample_speech_recognition do
controller Controllers::Sample::SpeechRecognition
end
topic :sample_delete_from_s3 do
controller Controllers::Sample::DeleteFromS3
end
topic :es_manage do
controller Controllers::Elasticsearch::Manage
end
end
end
App.boot!
# rubocop:enable Style/FrozenStringLiteralComment