CodeIgniter Forums
.env best practice for multiple applications - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: .env best practice for multiple applications (/showthread.php?tid=80519)



.env best practice for multiple applications - jacobarnold - 11-11-2021

I noticed when two CI4 applications are on the same server, parameters from one .env can affect a second application if the parameter name is the same and the user visits one application, then the other. Is the intent to use namespaces of some kind? In other words, instead of setting app.baseURL should I be setting appname1.baseURL and appname2.baseURL?


RE: .env best practice for multiple applications - kenjis - 11-13-2021

Where are the two .env?

Only .env in ROOTPATH is loaded.


RE: .env best practice for multiple applications - jacobarnold - 03-08-2022

(11-13-2021, 12:01 AM)kenjis Wrote: Where are the two .env?

Only .env in ROOTPATH is loaded.

Sorry, I was never notified of your reply. Here's the structure I have. I'm using separate system folders so the applications can be updated independently.

/var/www/html/app1/.env
/var/www/html/app2/.env

I guess this is just the nature of PHP environment variables.