What's the difference between the .env file and App.php? |
So I'm trying to learn CI 4 and I have a question.
In the .env file there are these settings: Code: # app.CSRFProtection = false And in Config/App.php there are these: Code: public $CSRFTokenName = 'csrf_test_name'; So what's the difference here? Where am I supposed to do my settings? Although I'm pretty sure it's working as it is without uncommenting the settings in the .env file. But why do they exist there?
So that you can have three servers with different .env files, and you don't need to touch your Config/App.php to change local settings.
I'm going to rename my Config.php next time I'm on the desktop and see if .env alone is adequate because Config.php works without a .env file
![]() Edit: I will also try different values in the two files and see which has priority...
What will happen if I have different settings in both the App.php file and the .env file. Which one will override the other?
Also worth noting: keeping the Config.php file free from passwords and other credentials is good practice, especially when checking-in code in a versioning system.
We use the .env file to set up stuff for development environment. The local environment is setup by the programmer and the CI/CO server inject the .env file for staging and production systems.
Just so that I understand correctly:
If I fill the "App.php" configuration file LOCAL with the "live" data AND I have an .env file, then the .env file works LOCAL, right? If I then transfer my project to the server WITHOUT the .env file, will the data from the configuration folder take effect? (02-20-2021, 08:03 PM)Codinglander Wrote: Just so that I understand correctly:Settings from the .env file will always overwrite your local settings from app/Config/*.php If no .env present, the settings from app/Config/*.php will be used.
Its quick acess to setting
Use to enable env file edit. env
Enlightenment Is Freedom
|
Welcome Guest, Not a member yet? Register Sign In |