CodeIgniter Forums
Facing Problems - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Facing Problems (/showthread.php?tid=89063)



Facing Problems - myseocompanyindia - 12-30-2023

I'm preparing to launch my website but I encounter a challenge: each time I upload the site from my local machine to the server, I have to adjust the config file. However, when I run it locally again, I need to reset the config once more. I'm curious if there's an alternative solution to tackle this problem. 

Thank you!"
Vijay


RE: Facing Problems - ozornick - 12-31-2023

Use .env file for configuration


RE: Facing Problems - InsiteFX - 12-31-2023

The only thing I have to do when I ftp my new site up to the server is just change the config base_url.


RE: Facing Problems - kcs - 12-31-2023

To avoid this, I make different versions of my .env file: I have a local one .env I use for development, one named .env-staging and one .env-production for the two other environments I use. When I deploy my project, depending on the environment, i rename the config I need into the .env file for the environment. I don't know if that is best practice – I have seen some security concerns when having config files inside version control systems... but it works great for me as I only use private repositories and I like the automation I can use for that task.