app.baseurl or public $baseURL |
I've been looking around but I still can't find a clear concept about the diferrences of these two:
PHP Code: app_baseURL = 'http://myurl.any/' PHP Code: public $baseURL = 'http://myurl.any/'; As far as my understanding goes about CodeIgniter the one declared on the .env file has development purposes only and the one in the App.php is for production... Or that's what I thougth. Running some tests today I found myself with an App crash after I removed/comment the public $baseURL from the App.php file even while in the .env file the CodeIgniter environment has been set as development. PHP Code: CI_ENVIRONMENT = development What's the real difference and case of use for each one of them?
Machines obbey the software instructions, software instructions obbeys the logic of the developer.
Therefore is not the systems fault if the developer's logic is fudged up! ¯\_(ツ)_/¯
The value in the .env file will override the value in the config file. It is designed to allow you to have a .env file in staging and another in production, both with the appropriate credentials for that environment. Then the credentials don't get saved in any repositories and kept safe on the respective servers.
I would advise you to specify Config\App.baseUrl in the .env file. Then the variable will be available directly via config("App.baseUrl") , not via getenv()
(08-03-2022, 06:35 AM)kilishan Wrote: The value in the .env file will override the value in the config file. It is designed to allow you to have a .env file in staging and another in production, both with the appropriate credentials for that environment. Then the credentials don't get saved in any repositories and kept safe on the respective servers. Fantastic answer, made it all clear now. Thank you so much Kilishan!
Machines obbey the software instructions, software instructions obbeys the logic of the developer.
Therefore is not the systems fault if the developer's logic is fudged up! ¯\_(ツ)_/¯ |
Welcome Guest, Not a member yet? Register Sign In |