-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathfeatures.server.ts
More file actions
29 lines (24 loc) · 705 Bytes
/
features.server.ts
File metadata and controls
29 lines (24 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { requestUrl } from "./utils/requestUrl.server";
export type TriggerFeatures = {
isManagedCloud: boolean;
};
function isManagedCloud(host: string): boolean {
return (
host === "cloud.trigger.dev" ||
host === "test-cloud.trigger.dev" ||
host === "internal.trigger.dev" ||
process.env.CLOUD_ENV === "development"
);
}
function featuresForHost(host: string): TriggerFeatures {
return {
isManagedCloud: isManagedCloud(host),
};
}
export function featuresForRequest(request: Request): TriggerFeatures {
const url = requestUrl(request);
return featuresForUrl(url);
}
export function featuresForUrl(url: URL): TriggerFeatures {
return featuresForHost(url.host);
}