Skip to content

Instantly share code, notes, and snippets.

@Mombuyish
Created February 23, 2020 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mombuyish/05b84eefc59f544a01367f872b0d83d3 to your computer and use it in GitHub Desktop.
Save Mombuyish/05b84eefc59f544a01367f872b0d83d3 to your computer and use it in GitHub Desktop.
<?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