1/ cp .env .env.testing
2/ SetAPP_ENV=testing
3/ Run php artisan migrate --env=testing
It's still picking from existing .env
Seems below functionality is missing as in laravel
/**
* Detect if a custom environment file matching the APP_ENV exists.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
protected function checkForSpecificEnvironmentFile($app)
{
if ($app->runningInConsole() && ($input = new ArgvInput)->hasParameterOption('--env')) {
if ($this->setEnvironmentFilePath(
$app, $app->environmentFile().'.'.$input->getParameterOption('--env')
)) {
return;
}
}
if (! env('APP_ENV')) {
return;
}
$this->setEnvironmentFilePath(
$app, $app->environmentFile().'.'.env('APP_ENV')
);
}
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
As "--env=xxx" will not be supported (see #1055) I managed to get this working this way:
File: bootstrap\app.php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$envFileName = ".env";
if (php_sapi_name() == 'cli') {
$input = new \Symfony\Component\Console\Input\ArgvInput();
$envParameterOption = $input->getParameterOption('--env');
if ($input->hasParameterOption('--env') && file_exists(__DIR__ . '/../' . $envFileName . '.' . $envParameterOption)) {
$envFileName .= '.' . $envParameterOption;
}
}
(new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
dirname(__DIR__), $envFileName
))->bootstrap();
Most helpful comment
As "--env=xxx" will not be supported (see #1055) I managed to get this working this way:
File:
bootstrap\app.php