Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing database.yml file in a project

I'm joining a project and am a bit confused because it doesn't have a database.yml file. So when I try to run "rake db:schema:load" or "rake db:setup", I get a complaint about the missing file.

I've spent more time with Mongo than MySQL so I'm not sure if it's standard to just make your database.yml by hand or through a rake task that I'm not seeing, or if the fact that it is missing is a problem.

like image 830
Jeremy Smith Avatar asked Dec 21 '22 08:12

Jeremy Smith


1 Answers

I guess your team intentionally exclude this file out from project due to this file contains DB's password.

You can create your own database.yml file (it's located at config/database.yml) ex.

 development:
   adapter: mysql
   database: rails_dev
   username: dev
   password: devpwd

 test:
   adapter: mysql
   database: rails_test
   username: test
   password: testpwd

 production:
   adapter: mysql
   database: rails_prod
   username: prod
   password: prodpwd

Edit: To secure your configuration file, you could use environment variable instead e.g.

  password: <%= ENV['APPNAME_PROD_PWD'] %>

This way you could store your configuration file in public area.

like image 198
datalost Avatar answered Jan 03 '23 02:01

datalost