Skip to content

Commit 58ee443

Browse files
committed
Show asset domain in output
1 parent c4d8c04 commit 58ee443

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/Commands/DeployCommand.php

+14
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ protected function buildProject(array $project)
137137
*/
138138
protected function assetDomain(array $project)
139139
{
140+
if ($this->usesCloudFront() && $domain = $this->customAssetDomain()) {
141+
return "https://$domain";
142+
}
143+
140144
if ($this->usesCloudFront() && $project['cloudfront_status'] == 'deployed') {
141145
return $project['asset_domains']['cloudfront'] ??
142146
$project['asset_domains']['s3'];
@@ -155,6 +159,16 @@ protected function usesCloudFront()
155159
return Manifest::current()['environments'][$this->argument('environment')]['cloudfront'] ?? true;
156160
}
157161

162+
/**
163+
* Determine if the project uses a custom asset domain.
164+
*
165+
* @return string|null
166+
*/
167+
protected function customAssetDomain()
168+
{
169+
return Manifest::current()['asset-domain'] ?? null;
170+
}
171+
158172
/**
159173
* Upload the deployment artifact.
160174
*

src/Commands/Output/DeploymentSuccess.php

+31-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function render(Deployment $deployment, DateTimeInterface $startedAt)
3434
}
3535

3636
$this->displayFunctionUrl($deployment);
37+
38+
$this->displayAssetDomainDnsRecordChanges($deployment);
3739
}
3840

3941
/**
@@ -111,11 +113,38 @@ protected function displayFunctionUrl(Deployment $deployment)
111113
Helpers::line();
112114

113115
Helpers::table([
114-
'<comment>Deployment ID</comment>',
115-
'<comment>Environment URL</comment>',
116+
'<comment>Domain</comment>',
117+
'<comment>Alias / CNAME</comment>',
116118
], [[
117119
"<options=bold>{$deployment->id}</>",
118120
"<options=bold>{$deployment->functionUrl()}</>",
119121
]]);
120122
}
123+
124+
/**
125+
* Display the DNS Records changes related to the asset domain.
126+
*
127+
* @param \Laravel\VaporCli\Models\Deployment $deployment
128+
* @return void
129+
*/
130+
protected function displayAssetDomainDnsRecordChanges(Deployment $deployment)
131+
{
132+
if (! $assetDomain = $deployment->manifest['asset-domain'] ?? null) {
133+
return;
134+
}
135+
136+
Helpers::line();
137+
138+
if ($deployment->created_asset_domain) {
139+
Helpers::line('<comment>Custom asset domain created:</comment> Custom domains may take up to an hour to become active after provisioning.');
140+
141+
Helpers::line();
142+
}
143+
144+
Helpers::table([
145+
'Domain', 'Alias / CNAME',
146+
], [[
147+
$assetDomain, $deployment->project['cloudfront_domain'],
148+
]]);
149+
}
121150
}

0 commit comments

Comments
 (0)