Skip to content

Commit

Permalink
fix(http): use document root instead of env in tempest serve (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
aazsamir authored Nov 12, 2024
1 parent f719c20 commit ccc1ece
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/Tempest/Http/src/Commands/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
)]
public function __invoke(string $host = 'localhost', int $port = 8000, string $publicDir = 'public/'): void
{
putenv("TEMPEST_PUBLIC_DIR={$publicDir}");
$routerFile = __DIR__ . '/router.php';
passthru("php -S {$host}:{$port} -t {$publicDir} {$routerFile}");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tempest/Http/src/Commands/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

$publicPath = getcwd() . '/' . rtrim($_ENV['TEMPEST_PUBLIC_DIR'], '/');
$publicPath = $_SERVER['DOCUMENT_ROOT'];

if (file_exists($publicPath . $_SERVER['REQUEST_URI'])) {
return false;
Expand Down

0 comments on commit ccc1ece

Please # to comment.