-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.rb
49 lines (41 loc) · 1.17 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
require 'bundler'
require 'active_support/core_ext/string'
require 'pry'
require 'guacamole'
ENV['RACK_ENV'] ||= 'development'
Bundler.require(:default, :development)
Dotenv.load ".env.#{ENV['RACK_ENV']}"
Mail.delivery_method.settings = {
address: ENV['SMTP_ADDRESS'],
port: ENV['SMTP_PORT'] || 465,
ssl: ENV['SMTP_USE_SSL'] == '1',
user_name: ENV['SMTP_USERNAME'],
password: ENV['SMTP_PASSWORD'],
domain: ENV['SMTP_DOMAIN']
}
# FIXME: Put this into Guacamole::Collection
module Guacamole::Collection
included do
include ClassMethods
end
module ClassMethods
def ensure_hash_index(options={})
on = Array.wrap options[:on]
unless connection.indices.detect {|index| index.on == on }
connection.add_index :hash, on: on, unique: options[:unique]
end
end
end
end
ENV['GUACAMOLE_ENV'] = ENV['RACK_ENV']
Guacamole.configure do |config|
logger = Logger.new("log/#{ENV['GUACAMOLE_ENV']}.log")
logger.level = 1
config.logger = logger
config.load File.join(File.dirname(__FILE__), 'config', 'guacamole.yml')
end
$:.unshift 'app/models'
require 'user'
require 'users_collection'
require 'repository'
require 'repositories_collection'