Subversion is a great way to update our web applications on our servers. With a simple svn update
all changed files get... well, changed.
Except for the omnipresent configuration files such as config.php
which hold the database access configuration, server paths etc. And are therefore different on my local development system and the remote server.
With the update
command, a file modified on the server won't get overwritten, but if I change the file locally and commit it, the server gets the wrong configuration file.
But I don't want to set the svn:ignore
property either, since the config file belongs to the project.
Is there a Subversion-mechanism which will allow me to easily handle these kind of files? Or is the only way to solve this problem to make a system switch within the config file which will determine the executing system and sets the configuration accordingly?
Create a template for the file (e.g. config.php-default) and let the user copy the template. She can also do a diff to see what changed between versions to incorporate these changes in the locally deployed version of the file.
You may want to consider the fact that developers won't (And probably shouldn't) have access to the username/passwords for the production machine.
To cope with this, such configuration should be considered to be 'deployment details', rather than overall application configuration. Even when you make this conceptual distinction, you still need to deal with the different deployment environments but, as you seem to be dealing with PHP, I can't comment on specifics for your case.
As Lars mentioned, one possible J2EE solution is to store such details under JNDI, making the exact same application binary deployable on any environment, leaving DBAs/Admins to set the username/password for each machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With