Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/drewblas/errbit into drew…
Browse files Browse the repository at this point in the history
…blas-master

Conflicts:
	db/seeds.rb
  • Loading branch information
Nick Recobra committed Mar 11, 2011
2 parents 391a127 + 4cbc243 commit 8c27563
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
23 changes: 23 additions & 0 deletions README.md
Expand Up @@ -67,6 +67,29 @@ for you. Checkout [Hoptoad](http://hoptoadapp.com) from the guys over at

cap deploy:setup deploy

**Deploying to Heroku:**

1. Clone the repository

git clone http://github.com/jdpace/errbit.git

2. Create & configure for Heroku

gem install heroku
heroku create
heroku addons:add mongohq:free
heroku addons:add sendgrid:free
heroku config:add HEROKU=true
heroku config:add ERRBIT_HOST=some-hostname.example.com
heroku config:add ERRBIT_EMAIL_FROM=example@example.com
git push heroku master

3. Seed the DB (_NOTE_: No bootstrap task is used on Heroku!)

heroku rake db:seed

4. Enjoy!

TODO
----

Expand Down
15 changes: 11 additions & 4 deletions config/initializers/_load_config.rb
@@ -1,11 +1,18 @@
require 'ostruct'

yaml = File.read(Rails.root.join('config','config.yml'))
config = YAML.load(yaml)
if ENV['HEROKU']
Errbit::Config = OpenStruct.new
Errbit::Config.host = ENV['ERRBIT_HOST']
Errbit::Config.email_from = ENV['ERRBIT_EMAIL_FROM']
Errbit::Config.email_at_notices = [1,3,10] #ENV['ERRBIT_EMAIL_AT_NOTICES']
else
yaml = File.read(Rails.root.join('config','config.yml'))
config = YAML.load(yaml)

config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env)
config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env)

Errbit::Config = OpenStruct.new(config)
Errbit::Config = OpenStruct.new(config)
end

# Set config specific values
ActionMailer::Base.default_url_options[:host] = Errbit::Config.host
9 changes: 9 additions & 0 deletions config/initializers/mongo.rb
@@ -0,0 +1,9 @@
if ENV['MONGOHQ_URL']
settings = URI.parse(ENV['MONGOHQ_URL'] || 'mongodb://localhost/sushi')
database_name = settings.path.gsub(/^\//, '')

Mongoid.configure do |config|
config.master = Mongo::Connection.new(settings.host, settings.port).db(database_name)
config.master.authenticate(settings.user, settings.password) if settings.user
end
end
4 changes: 2 additions & 2 deletions db/seeds.rb
Expand Up @@ -14,8 +14,8 @@
:name => 'Errbit Admin',
:email => admin_email,
:password => admin_pass,
:password_confirmation => admin_pass,
:password_confirmation => admin_pass
})

user.admin = true
user.save!
user.save!

0 comments on commit 8c27563

Please sign in to comment.