Skip to content

Commit 5ce7dbe

Browse files
committed
handle env vars
1 parent 44b3ae6 commit 5ce7dbe

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Commands/StartRoadRunnerCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
8383
'-o', 'logs.output=stdout',
8484
'-o', 'logs.encoding=json',
8585
'serve',
86-
]), base_path(), ['APP_BASE_PATH' => base_path(), 'LARAVEL_OCTANE' => 1], null, null))->start();
86+
]), base_path(), collect(array_merge($_ENV, [
87+
'APP_BASE_PATH' => base_path(),
88+
'LARAVEL_OCTANE' => 1]))->mapWithKeys(function ($value, $key) {
89+
return in_array($key, ['APP_ENV', 'APP_BASE_PATH', 'LARAVEL_OCTANE'])
90+
? [$key => $value]
91+
: [$key => false];
92+
})->all(), null, null))->start();
8793

8894
$serverStateFile->writeProcessId($server->getPid());
8995

src/Commands/StartSwooleCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ public function handle(
7070

7171
$server = tap(new Process([
7272
(new PhpExecutableFinder)->find(), 'swoole-server', $serverStateFile->path(),
73-
], realpath(__DIR__.'/../../bin'), ['APP_BASE_PATH' => base_path(), 'LARAVEL_OCTANE' => 1], null, null))->start();
73+
], realpath(__DIR__.'/../../bin'), collect(array_merge($_ENV, [
74+
'APP_BASE_PATH' => base_path(),
75+
'LARAVEL_OCTANE' => 1]))->mapWithKeys(function ($value, $key) {
76+
return in_array($key, ['APP_ENV', 'APP_BASE_PATH', 'LARAVEL_OCTANE'])
77+
? [$key => $value]
78+
: [$key => false];
79+
})->all(), null, null))->start();
7480

7581
return $this->runServer($server, $inspector, 'swoole');
7682
}

0 commit comments

Comments
 (0)