How do you override your team's default databases.yml in Doctrine for using your local settings?

两盒软妹~` 提交于 2019-12-06 08:28:48

For this kind of configuration file, that contains stuff that depends on the environment (dev, testing, staging, production, ...), I generally use one file per environment, and all are commited to source-control.

For example, I could have :

  • databases.yml == the development version, which will work when the project is checked out from source-control on a development computer.
  • databases.testing.yml
  • databases.staging.yml
  • databases.production.yml


Then, when building the .tag.gz (or similar) archive that will be deployed to a different environment, I copy the file that corresponds to the destination's to the default one.

For example, when creating an archive that will be deployed on the production server, I copy databases.production.yml to databases.yml, in the archive.

This way, the application always uses databases.yml, no matter what environment it's deployed on -- and all the possible configurations are commited to source-control.


Of course, this works much better if you are having some packaging / build process -- and don't just upload file to the servers via FTP by hand...

I generally add database.yml to svn:ignore and instead commit database.yml.sample.

The local will copy the database.yml.sample as database.yml and add their own values.

This way the database.yml file cannot be accidentally committed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!