Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ class Event
*/
public $exitCode;

/**
* The additional environment variables for the command.
*
* @var array
*/
public $environment = [];

/**
* Create a new event instance.
*
Expand Down Expand Up @@ -198,7 +205,7 @@ protected function start($container)
protected function execute($container)
{
return Process::fromShellCommandline(
$this->buildCommand(), base_path(), null, null, null
$this->buildCommand(), base_path(), $this->environment, null, null
)->run(
laravel_cloud()
? fn ($type, $line) => fwrite($type === 'out' ? STDOUT : STDERR, $line)
Expand Down Expand Up @@ -474,6 +481,18 @@ protected function getEmailSubject()
return "Scheduled Job Output For [{$this->command}]";
}

/**
* Set the additional environment variables for the command.
*
* @return $this
*/
public function env(array $environment)
{
$this->environment = $environment;

return $this;
}

/**
* Register a callback to ping a given URL before the job runs.
*
Expand Down
Loading