Should I use .gitignore or automatically detect configurations for different servers in stage?

I work for a company where we currently do not have a workflow, and everything is getting stressful. I am trying to create the right workflow and have read some great tutorials and resources for different approaches. The workflow that I will use is that developers commit and push their codes to dev repos, which are then copied to prod repo. Then, on the prod server, a simple push is performed.

We use CakePHP. There are 2 servers (prod and dev) and, of course, localhost. However, the configurations (db, payments, auth, etc.) are different for each environment. My main question is: which option is best from below (other suggestions are also welcome)?

OPTION 1:

  • Configure all three environments with appropriate configurations
  • Use .gitignore to ignore file-specific configurations and files
  • Use simple push / pull

OPTION 2:

  • Using PHP mechanisms to discover the environment and select the appropriate configuration
  • No need to use .gitignore (except how you can simply ignore tmp files, etc.)
  • Use simple push / pull

I would like to know that this is the best way to do this. Also, the recommendation for an easy-to-deploy Git workflow would be great.

+6
source share
1 answer

This is exactly what your .gitignore file is .gitignore , go with option 1.

+3
source

Source: https://habr.com/ru/post/927966/


All Articles