php - Laravel: Do multiple environments require multiple .env files? -


in laravel 4.x possible have development , production environment 1 configuration file. framework detect automatically should used according host.

with laravel 5.x seems have take following approach:

  • on local machine .env file in root directory "app_env=local" , other config stuff run locally.

  • on server same thing "app_env=production" , related settings.

so if deploy site, have watch don't overwrite .env file on server local version.

is correct far or missing here?

the main goal keep sensitive data out of version control , have in 1 place.

following points , questions approach unclear:

  • the creator of .env package recommends not use in production mode (source: https://github.com/vlucas/phpdotenv). solution in laravel issue hard code every setting across framework , make sure .env file not deployed server (could huge security hole).

  • if solution in point above used, how keep sensitive data out of version control?

  • let's 2 different .env files used (for development , 1 server in production mode), wouldn't performance issue in production since each setting being called on , on again .env file?

this seems step 4.x approach have configured , done in 1 place, no need have 2 different files same name , watch don't mix them or something. , loading 1 array in .php lot faster calling 1 file multiple times.

yes right. 5.x have create totally different .env files on single environment development, staging, production etc included in .gitignore git system doesn't care it. every manipulation should made hand once again when change environment.

the typical process ssh remote machine, git clone project, composer install dependencies , create brand new .env file should put dedicated settings regarding environment. guide .env.example.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -