What is the right way to maintain a “version for the server” - with only config files changed, in Git?

前端 未结 3 901
北恋
北恋 2020-11-22 04:35

I sometimes work with Codeigniter, and after I\'m done developing on the local site, I need to migrate the files to the server. All the files in the /config/ fo

3条回答
  •  春和景丽
    2020-11-22 04:58

    Create two folders in the config folder. One is called development and the other is production. Now copy config.php, database.php etc to each of these folders. Now when you are on production server, CodeIgniter will first check the production folder for the files. If it is not there, then it uses the default file in the config folder. And if you are on development environment, CodeIgniter will first check the development folder.

    If you want to keep any config file identical to the production and development environment, keep it in config folder.

    If you want to set the environment then add the following code in .htaccess file:

    #This code for Development Environment
    SetEnv CI_ENV development
    

    and

    #This code for Production Environment
    SetEnv CI_ENV production
    

提交回复
热议问题