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
23 changes: 23 additions & 0 deletions src/Console/ExecuteToolCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class ExecuteToolCommand extends Command

public function handle(): int
{
// Refresh environment variables
$this->refreshEnvironmentVariables();

$toolClass = $this->argument('tool');
$argumentsEncoded = $this->argument('arguments');

Expand Down Expand Up @@ -54,4 +57,24 @@ public function handle(): int
return 1;
}
}

/**
* Refresh environment variables and configuration.
*/
protected function refreshEnvironmentVariables(): void
{
// Clear any cached config file
$configPath = app()->getCachedConfigPath();
if (file_exists($configPath)) {
unlink($configPath);
}

// Reload environment variables
$envLoader = new \Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables();
$envLoader->bootstrap(app());

// Force reload configuration from files
$configLoader = new \Illuminate\Foundation\Bootstrap\LoadConfiguration();
$configLoader->bootstrap(app());
}
}