php - Missing the point: Laravel 5 environment setup -
so, application see 4 types of environments can run under:
- local on machine
- local on vm using homestead
- staging
- production
each environment differs in database connectivity (type of db, connectivity db credentials, etc).
in bootstrap/start.php have set this:
$env = $app->detectenvironment(array( 'local' => array('localhost'), 'localstaging' => array('mylocalstage.dev'), 'staging' => array('myapp-stage.com'), 'production' => array('myapp.com'), ));
how enforce settings? set when i'm on 'local' use local settings? when use
php artisan env
on root application folder get:
current application environment: production
why isn't picking i'm 'local'?
after discussing issue in comments , in chat, conclusion use new .env approach have been introduced in laravel 5.
which means, should have .env
file in root directory current environment's settings.
so local env, .env file have different settings production's env .env file.
as default should have .env.example
file, in case don't have 1 - can copy default content git (.env.example@git).
please notice when you're updating (pushing) local version staging (for instance), don't overwrite .env
file. in order prevent kind of issues can use git ignore (so skip file).
Comments
Post a Comment