在Doctrine中如何覆盖团队的默认database.yml以使用本地设置? [英] How do you override your team's default databases.yml in Doctrine for using your local settings?
问题描述
寻找一种在Doctrine / Symfony中干净地覆盖databases.yml的值以便使用我自己的本地设置的方法?
Looking for a way to cleanly override the values of databases.yml in Doctrine / Symfony in order to use my own local settings?
这个想法不是触摸数据库.yml并使用某种本地未版本的文件来覆盖该默认值。
The idea is not touching databases.yml and using some sort of local unversioned file to override that default.
我试图找出如何没有多少成功:/
I'm trying to find out how without much success yet :/
推荐答案
对于这种配置文件,包含东西这取决于环境(开发,测试,分期,生产,...),我通常每个环境使用一个文件,并且都被提交给源代码控制。
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.
例如,我可以:
-
databases.yml
==开发版本,当开发计算机上的源代码控制项目被检出时,它将工作。 -
databases.testing.yml
-
databases.staging.yml
-
databases.production.yml
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
然后,当构建 .tag.gz
(或类似)将部署到差异的归档例如,当创建将部署在生产服务器上的归档文件时,我将复制到目录的目录文件。
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.
databases.production.yml
至 databases.yml
,存档。
这样,应用程序始终使用 databases.yml
,无论它部署了什么环境,所有可能的配置都被提交给源代码控制。
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.
当然,如果您有一些打包/构建过程,而且不要上传文件通过手动FTP到服务器...
这篇关于在Doctrine中如何覆盖团队的默认database.yml以使用本地设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!