Skip to content

Commit 7a13da4

Browse files
author
Marylou Kunkle
committed
Configure files support development env
The previous configuration files were strictly for production mode, but these support development mode. Also, it fixes the mongod problem.
1 parent aa306d4 commit 7a13da4

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

config.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require 'sinatra'
55
require 'sass/plugin/rack'
66
use Sass::Plugin::Rack
77

8-
set :env, :production
8+
set :env, :development
99

1010
require 'hackety'
1111

configure.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010

1111
#this method will set up our database connection for any environment
1212
def setup_db environ
13-
#we want to connect to mongohq
14-
MongoMapper.connection = Mongo::Connection.new(ENV['MONGOHQ_HOST'], ENV['MONGOHQ_PORT'])
15-
MongoMapper.database = ENV['MONGOHQ_DATABASE']
16-
MongoMapper.database.authenticate(ENV['MONGOHQ_USER'],ENV['MONGOHQ_PASSWORD'])
13+
if environ == :production
14+
#we want to connect to mongohq
15+
MongoMapper.connection = Mongo::Connection.new(ENV['MONGOHQ_HOST'], ENV['MONGOHQ_PORT'])
16+
MongoMapper.database = ENV['MONGOHQ_DATABASE']
17+
MongoMapper.database.authenticate(ENV['MONGOHQ_USER'],ENV['MONGOHQ_PASSWORD'])
18+
else
19+
MongoMapper.connection = Mongo::Connection.new('localhost')
20+
MongoMapper.database = "hackety-#{environ}"
21+
end
1722
end
1823

1924
#these configure blocks only run in one environment

0 commit comments

Comments
 (0)