Skip to content

Commit

Permalink
abstracted db info
Browse files Browse the repository at this point in the history
  • Loading branch information
Danish Khan committed Mar 16, 2011
1 parent 5a5ff9c commit a2a00bc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions toopaste.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
# check current env
environment = Sinatra::Application.environment
# set database connection
@ADAPTER = settings["#{environment}"]["adapter"]
@HOST = settings["#{environment}"]["host"]
@USERNAME = settings["#{environment}"]["username"]
@PASSWORD = settings["#{environment}"]["password"]
@DB = settings["#{environment}"]["database"]
DataMapper.setup(:default, {
:adapter => 'mysql',
:host => 'localhost',
:adapter => @ADAPTER,
:host => @HOST,
:username => @USERNAME,
:password => @PASSWORD,
:database => 'toopaste'
:database => @DB
})
end

configure :test do
DataMapper.setup(:default, "sqlite::memory:")
end

class Snippet
include DataMapper::Resource

Expand Down

0 comments on commit a2a00bc

Please sign in to comment.