Skip to content

Commit

Permalink
Throw \Dotenv\Exception\InvalidPathException if .env is doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
fab120 committed Jul 30, 2021
1 parent 352b0bd commit ac6916e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions config/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@
: ['.env'];

$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, $env_files, false);
if (file_exists($root_dir . '/.env')) {
$dotenv->load();
$dotenv->required(['WP_HOME', 'WP_SITEURL']);
if (!env('DATABASE_URL')) {
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
}
$dotenv->load();
$dotenv->required(['WP_HOME', 'WP_SITEURL']);
if (!env('DATABASE_URL')) {
$dotenv->required(['DB_NAME', 'DB_USER', 'DB_PASSWORD']);
}

/**
Expand Down

0 comments on commit ac6916e

Please sign in to comment.