Welcome Guest, Not a member yet? Register   Sign In
Codigniter 4.6.1 not loading config files based on environment
#10

Thanks for the response. The ci4 I downloaded from the website, I did not modify anything, just renamed the env to .env, and it did not load, that was the error I was reporting.
I believe solutions should stay simple and be very flexible, the env file being loaded in the index.php was very good and makes it possible to use it in "distributed" environments, where the same "app" and "system" is used to run multiple databases/setups.
With the update that you did, it makes it difficult to do that. What I have done is to load the env file in the index.php file, did that in just 2 lines of code, no new file created, no complications. The file name always remains .env, but can be kept in any directory, not just the ROOTPATH, again for added security, such things files should not be in the "obvious" places.
The second issue was the ability of the frame work to load config files based on the "ENVIRONMENT", that ability is also helpful. If I am deploying the same code base across multiple servers for different clients, all I have to do is to ensure that I have their .env file and their config file, and working on it becomes easy. I will be glad if that can be considered. 
At the moment, I have to set the different settings in an array, and use the environment variable to load the values. If I deploy such codebase to multiple clients, they will be aware of other clients configuration, and that is not cool.
The ability to serve different configurations should be a serious consideration, the config helps do that easily, very helpful for the developer. But how do we come up with ci4 updates ? what determines what is taken away and what is introduced?
Thanks
Reply


Messages In This Thread
RE: Codigniter 4.6.1 not loading config files based on environment - by chenzen - 06-03-2025, 10:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB