Skip to content

Commit da3e8a1

Browse files
committed
feat: support custom staging urls in cli output
1 parent 9f05c9c commit da3e8a1

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/manifest.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,29 @@ export class Manifest {
163163
}
164164

165165
get links(): ManifestLinks {
166-
// TODO: Allow customizing the staging URL using `fileset.yaml` configuration.
167-
const hostnameSuffix =
166+
let hostnameSuffix =
168167
process.env.FILESET_BASE_URL ||
169168
`fileset-dot-${this.googleCloudProject}.appspot.com`;
169+
if (
170+
hostnameSuffix.includes('-dot-') &&
171+
!hostnameSuffix.startsWith('-dot-')
172+
) {
173+
hostnameSuffix = `-dot-${hostnameSuffix}`;
174+
} else if (
175+
!hostnameSuffix.startsWith('.') &&
176+
!hostnameSuffix.includes('-dot-')
177+
) {
178+
hostnameSuffix = `.${hostnameSuffix}`;
179+
}
170180
const buildLink =
171181
this.site === 'default'
172-
? `https://${this.shortSha}-dot-${hostnameSuffix}`
173-
: `https://${this.site}-${this.shortSha}-dot-${hostnameSuffix}`;
182+
? `https://${this.shortSha}${hostnameSuffix}`
183+
: `https://${this.site}-${this.shortSha}${hostnameSuffix}`;
174184
const branchToken = branchToHostnameToken(this.branch);
175185
const stagingLink =
176186
this.site === 'default'
177-
? `https://${branchToken}-dot-${hostnameSuffix}`
178-
: `https://${this.site}-${branchToken}-dot-${hostnameSuffix}`;
187+
? `https://${branchToken}${hostnameSuffix}`
188+
: `https://${this.site}-${branchToken}${hostnameSuffix}`;
179189
const dashboardLink = `https://${hostnameSuffix}/fileset/sites/${this.site}/${this.shortSha}`;
180190
return {
181191
stagingLink: stagingLink,

0 commit comments

Comments
 (0)