Created
February 23, 2020 09:37
-
-
Save Mombuyish/05b84eefc59f544a01367f872b0d83d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables | |
public function bootstrap(Application $app) | |
{ | |
if ($app->configurationIsCached()) { // if it cached, return empty | |
return; | |
} | |
$this->checkForSpecificEnvironmentFile($app); | |
try { | |
$this->createDotenv($app)->safeLoad(); | |
} catch (InvalidFileException $e) { | |
$this->writeErrorAndDie($e); | |
} | |
} | |
// check environment. | |
protected function checkForSpecificEnvironmentFile($app) | |
{ | |
if ($app->runningInConsole() && ($input = new ArgvInput)->hasParameterOption('--env')) { | |
if ($this->setEnvironmentFilePath( | |
$app, $app->environmentFile().'.'.$input->getParameterOption('--env') | |
)) { | |
return; | |
} | |
} | |
$environment = Env::get('APP_ENV'); | |
if (! $environment) { | |
return; | |
} | |
$this->setEnvironmentFilePath( | |
$app, $app->environmentFile().'.'.$environment | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment