I have a Sinatra app which uses DataMapper as it’s ORM, it’s deployed to Heroku, but I want to change the database details.
Right now before my Models, I’m connecting to my DB like this, but I want to use a yml file to manage the connections details.
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3::memory:")
If I have a file thats at config/database.yml, how can I change the DataMapper.setup to use the proper ENV? This way I can remove the need for sqlite3 as I’ll be running Postgres locally too.
As far as I know, DataMapper doesn’t parse
.yml. You can look at https://github.com/merb/merb_datamapper/blob/master/lib/merb_datamapper/connection.rb to see how.ymlconfig is consumed in Merb framework.