-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
64 lines (54 loc) · 1.77 KB
/
app.rb
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
58
59
60
61
62
63
64
require 'grape'
require 'grape_entity'
require 'active_record'
require 'grape/activerecord'
require 'yaml'
require 'pry'
require 'mail'
require 'newrelic_rpm'
require 'newrelic-grape'
require 'sidekiq'
# API
require './api/v1/users'
require './api/v1/slyps'
require './api/v1/slyp_chats'
require './api/v1/slyp_chat_messages'
require './api/v1/base'
Dir[Dir.pwd + "/api/v1/**/*.rb"].each { |f| require f }
require './api/base'
# Models
Dir[Dir.pwd + "/models/**/*.rb"].each { |f| require f }
# Workers
Dir[Dir.pwd + "/workers/**/*.rb"].each { |f| require f }
# Services
Dir[Dir.pwd + "/services/**/*.rb"].each { |f| require f }
# CONFIGURATIONS
ENV['RACK_ENV'] ||= "development"
# DB config
dbconfig = YAML::load(File.open('config/database.yml'))
ActiveRecord::Base.establish_connection(dbconfig[ENV["RACK_ENV"]])
ActiveRecord::Base.logger = nil
#Domain
domains = YAML::load(File.open('config/domains.yml'))[ENV["RACK_ENV"]]
UI_DOMAIN = domains["ui"]
API_DOMAIN = domains["api"]
# Email Configs
mailer = YAML::load(File.open('config/mailer.yml'))[ENV["RACK_ENV"]]
mail_options = { :address => mailer["address"],
:port => mailer["port"],
:domain => mailer["domain"],
:user_name => mailer["user_name"],
:password => mailer["password"],
:authentication => mailer["authentication"],
:enable_starttls_auto => true
}
Mail.defaults do
delivery_method :smtp, mail_options
end
# REDIS CONFIG
# Sidekiq.configure_server do |config|
# config.redis = { url: 'redis://redis.example.com:7372/12' }
# end
# Sidekiq.configure_client do |config|
# config.redis = { url: 'redis://redis.example.com:7372/12' }
# end