forked from jejacks0n/bitbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
26 lines (20 loc) · 947 Bytes
/
config.ru
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
root = File.expand_path("../../lib", __FILE__)
$:.unshift(root) unless $:.include?(root)
require "bitbot"
Bitbot.configure do |config|
config.redis_connection = proc { Redis.current ||= Redis.new(url: ENV["REDIS_URL"] || "redis://127.0.0.1:6379") }
config.locales = Dir[File.expand_path("../../locale/*.yml", __FILE__)]
config.responders = Dir[File.expand_path("../../lib/bitbot_responders/**/*_responder.rb", __FILE__)]
config.load_responders
config.listener do |listener|
listener.token = ENV["BITBOT_OUTGOING_WEBHOOK_TOKEN"] || "token"
listener.path = "/rack-bitbot-webhook"
end
config.on_exception do |e, request|
Bitbot.log("#{e.class.name}: #{e.message} -- #{request.method} #{request.path}")
end
end
# start the rack application with the web listener (useful within a config.ru file)
run Bitbot.listener
# start a rack server directly (useful for an executable file)
# Bitbot.listen(Bitbot::Listener::Web)