Is it a must to set environment variables in Laravel 5?
On a droplet, I have created two Linux user accounts and setup Laravel 5 for each of them at the following paths:
- User account 1 >> Maps to dev.example.com.conf virtualhost>> Maps to dev.example.com, with Laravel installed at /home/devuser/public_html
- User account 2 >> Maps to beta.example.com.conf virtualhost>> Maps to beta.example.com, with Laravel installed at /home/betauser/public_html
I installed Laravel through composer and at the root of each Laravel install, I notice a .env file, which has the Laravel API key automatically written to it. But, that file also has a whole bunch of other variables, including the following:
APP_ENV=local APP_DEBUG=true APP_KEY=Key(obfuscated) APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync etc.
The default Laravel page loads when I try https://dev.example.com and https://beta.example.com (installed LetsEncrypt and redirected all requests to https), but I am a bit confused if it's also necessary to specify the details in the respective .env files as below:
APP_ENV=dev APP_DEBUG=true APP_KEY=Key(obfuscated) APP_URL=https://dev.example.com
and, also specify the respective db details.
Thanks in advance.