Skip to content

Commit

Permalink
Return 500 http error, instead of 200, when dotenv fails to load (#45235
Browse files Browse the repository at this point in the history
)

* Return 500 http error, instead of 200

When dotenv fails, the response on http is always 200.

Because of 200 response, alerts might not be triggered, and data will be cached :(

* Update LoadEnvironmentVariables.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
cosminardeleanu and taylorotwell committed Dec 9, 2022
1 parent f72d9eb commit 1c10e4f
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -103,6 +103,8 @@ protected function writeErrorAndDie(InvalidFileException $e)
$output->writeln('The environment file is invalid!');
$output->writeln($e->getMessage());

http_response_code(500);

exit(1);
}
}

0 comments on commit 1c10e4f

Please sign in to comment.