Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling different configurations with git

I am doing a Laravel 4 project, and there is an option on mail.pjp, where you can pretend to send an email, but you actually are logging it locally into a file. This is useful for development.

The problem I have is with version control. If I check in, this option as "true", then I risk that when I update the production server, it might disable emails if I am not careful.

On the other hand, if I check in the file in git as "true", it might happen what happened today, that I lost a good couple of hours trying to understand why the mail was not working because I forgot I had to change this option for my development environment.

What way could I handle these "production vs development" configuration issues with git?

like image 821
Enrique Moreno Tent Avatar asked Jun 15 '26 03:06

Enrique Moreno Tent


1 Answers

Have a branch for each configuration.

For instance, you could have a production branch and a dev branch.

On the production branch, just make one commit to change the configuration file, then use the dev branch the same way you used your master branch.

The deployment process becomes

On dev:

  • git checkout production
  • git merge dev
  • git push origin production

On production:

  • git pull origin production

Or split your configuration file

And maybe add some runtime test to pick the good one at the right time.

like image 70
Benjamin Toueg Avatar answered Jun 17 '26 00:06

Benjamin Toueg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!