Welcome Guest, Not a member yet? Register   Sign In
Working with environments
#1

Hi all

I've read https://codeigniter.com/user_guide/insta...nning.html and https://codeigniter.com/user_guide/gener...ments.html but I still need help wrapping my head around how to work with environments. Sorry, but I'm fairly new to php and codeigniter.

So my setup is CI4 with a local development server (localhost/mysite) and a remote production server (mysite.com). I push my local changes to github where the files are copied & pasted to the webserver automatically. 

How should I setup the environments? Do I need multiple .env files, one for local and one for production? Should I .gitignore the .env and keep two seperate configurations local and on the production server? Do I have to configure something on the production webserver?

And furthermore, does it matter what baseURL is defined in App.php if I overwrite it in the .env-file anyway?

Any help is much apreaciated Smile

Regards
Tobi
Reply
#2

I just found this part of the documentation https://codeigniter.com/user_guide/gener...ation.html where it's advised to .gitignore the .enf file. This is the advice I was looking for.

So I'll configure my setup as follows:

  • In App.php set baseURL to the production url (mysite.com)
  • leave the default .env file on the production server without any configuration, CI assumes produciton environment anyway
  • gitignore my local .env file
  • change the baseURL in my local .env to (localhost/mysite) + any other configuration
Makes it kind of hard to share local configurations with teammates but I guess it's better than before Big Grin

Any comments?
Tobias
Reply




Theme © iAndrew 2016 - Forum software by © MyBB