Skip to content

Commit 0588478

Browse files
committed
Add support for multiple domains to FILESET_LIVE_DOMAIN
1 parent 9477128 commit 0588478

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/server.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ test('Test parseHostname', (t: ExecutionContext) => {
2020
branchOrRef: 'master',
2121
}
2222
);
23+
// Multiple live domains.
24+
t.deepEqual(
25+
server.parseHostname('example.com', 'example', 'example.com,foo.com'),
26+
{
27+
siteId: 'example',
28+
branchOrRef: 'master',
29+
}
30+
);
2331
// Some other domain.
2432
t.deepEqual(
2533
server.parseHostname('something.com', 'example', 'example.com'),

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const getManifest = async (siteId: string, branchOrRef: string) => {
5454
export function parseHostname(hostname: string, defaultSiteId?: string, defaultLiveDomain?: string) {
5555
let siteId = defaultSiteId || 'default';
5656
let branchOrRef = '';
57-
if (hostname == defaultLiveDomain) {
57+
if (defaultLiveDomain && defaultLiveDomain.split(',').includes(hostname)) {
5858
// Hostname is the "live" or "prod" domain. Use the master branch.
5959
branchOrRef = 'master';
6060
} else if (hostname.includes('-dot-')) {

0 commit comments

Comments
 (0)