trugul-bot/environments.rb

32 lines
709 B
Ruby
Raw Normal View History

2015-04-26 09:42:23 -04:00
require 'rubygems'
require 'bundler'
Bundler.require
2015-04-26 10:17:53 -04:00
require 'will_paginate'
require 'will_paginate/active_record'
include WillPaginate::Sinatra::Helpers
2015-04-26 09:42:23 -04:00
require './models/raid'
require './models/leader'
require './helpers/raids_helper'
require './jobs/leaders'
2015-04-15 11:00:32 -04:00
configure :development do
2015-04-26 09:42:23 -04:00
set :database, 'sqlite3:dev.db'
set :show_exceptions, true
2015-04-15 11:00:32 -04:00
end
configure :production do
2015-04-26 09:42:23 -04:00
db = URI.parse(ENV['DATABASE_URL'] || 'postgres:///localhost/mydb')
2015-04-15 11:00:32 -04:00
2015-04-26 09:42:23 -04:00
ActiveRecord::Base.establish_connection(
2015-04-15 11:00:32 -04:00
:adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
:host => db.host,
:username => db.user,
:password => db.password,
:database => db.path[1..-1],
:encoding => 'utf8'
2015-04-26 09:42:23 -04:00
)
2015-04-15 11:00:32 -04:00
end