Skip to content

Commit

Permalink
DotEnvCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk committed May 26, 2023
1 parent d09a20d commit 453137b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"laravel-notification-channels/telegram": "^4.0",
"mtdowling/cron-expression": "^1.2",
"spatie/laravel-package-tools": "^1.14.0",
"symfony/dom-crawler": "^6.2",
"vlucas/phpdotenv": "^5.5"
},
"require-dev": {
Expand Down
10 changes: 6 additions & 4 deletions src/Checks/DotEnvCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ public function run(): Result
);

$missing = collect($this->required)
->filter(fn ($variable) => ! $vars->has($variable));
->filter(fn ($variable, $value) => is_int($value) ? ! $vars->has($variable) : $vars->get($value) != $variable);

dd($missing);

return $result->ok();
if ($missing->isNotEmpty()) {
return $result->failed('Missing required variables in .env file: '.$missing->implode(', '));
} else {
return $result->ok();
}
}
}

0 comments on commit 453137b

Please sign in to comment.