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...