Skip to content

Commit d520959

Browse files
sbourouisjessarcher
andcommitted
Remove baseUrl parameter from DeployCommand
Co-authored-by: Jess Archer <[email protected]>
1 parent 3ea2df0 commit d520959

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

config/nightwatch.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
'token' => env('NIGHTWATCH_TOKEN'),
66
'deployment' => env('NIGHTWATCH_DEPLOY'),
77
'server' => env('NIGHTWATCH_SERVER', (string) gethostname()),
8-
'base_url' => env('NIGHTWATCH_BASE_URL', 'https://nightwatch.laravel.com'),
98
'capture_exception_source_code' => env('NIGHTWATCH_CAPTURE_EXCEPTION_SOURCE_CODE', true),
109
'redact_headers' => explode(',', env('NIGHTWATCH_REDACT_HEADERS', 'Authorization,Cookie,Proxy-Authorization,X-XSRF-TOKEN')),
1110

src/Console/DeployCommand.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @internal
1616
*/
17-
#[AsCommand(name: 'nightwatch:deploy', description: 'Notice the Nightwatch agent that a new deployment has been made.')]
17+
#[AsCommand(name: 'nightwatch:deploy', description: 'Notify Nightwatch of a deployment.')]
1818
final class DeployCommand extends Command
1919
{
2020
/**
@@ -27,11 +27,10 @@ final class DeployCommand extends Command
2727
/**
2828
* @var string
2929
*/
30-
protected $description = 'Notice the Nightwatch agent that a new deployment has been made.';
30+
protected $description = 'Notify Nightwatch of a deployment.';
3131

3232
public function __construct(
3333
private HttpFactory $http,
34-
private ?string $baseUrl,
3534
#[SensitiveParameter] private ?string $token,
3635
) {
3736
parent::__construct();
@@ -41,11 +40,7 @@ public function handle(): void
4140
{
4241
$tag = config('nightwatch.deployment') ?? '';
4342

44-
if (! $this->baseUrl) {
45-
$this->error('No Nightwatch base URL configured.');
46-
47-
return;
48-
}
43+
$baseUrl = $_SERVER['NIGHTWATCH_BASE_URL'] ?? 'https://nightwatch.laravel.com';
4944

5045
if (! $this->token) {
5146
$this->error('No Nightwatch token configured.');
@@ -60,7 +55,7 @@ public function handle(): void
6055
'Accept' => 'application/json',
6156
'Content-Type' => 'application/json',
6257
])
63-
->post("{$this->baseUrl}/api/deployments", [
58+
->post("{$baseUrl}/api/deployments", [
6459
'timestamp' => now()->timestamp,
6560
'version' => $tag,
6661
]);

src/NightwatchServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ private function registerDeployCommand(): void
233233
$this->app->singleton(DeployCommand::class, fn () => new DeployCommand(
234234
http: $this->app->make(\Illuminate\Http\Client\Factory::class),
235235
token: $this->nightwatchConfig['token'] ?? null,
236-
baseUrl: $this->nightwatchConfig['base_url'] ?? null,
237236
));
238237
}
239238

0 commit comments

Comments
 (0)