35dbaedf69
* add amin email regex env var * fix displayed init command for self-hosted setups * shared env var to disable telemetry in cli and webapp * pin sdk version during init * if specified, add api url to dev command shown after init * improve checkpoint support detection * control forced checkpoint simulation via env var * add public init to providers * better checkpoint support check for coordinator * add docker to coordinator image * update docker provider containerfile * bump remaining containers to node 20 * add infra image build to default publish workflow * lockfile * remove concurrency group from infra workflow * add docker provider to build matrix * fix var subst * checkpoint test is docker specific * enable v3 projects by default on self-hosted instances * fix v3 setup command again * add default posthog key * self-hosting docs * add latest tags to versioned infra and webapp builds * some checkpoint errors should skip retrying * add changeset * shorten paragraph * some docs updates * update tunnelling section * add registry setup section * use correct cli push flag * add checkout to v3 branch * update the worker machine setup steps * fix infra build * small docs update * remove unused feature function * Revert "remove unused feature function" This reverts commit cfe07887a12b6893dca8ce499964481a9b3dc9db. * fix self-hosted v3 feature gate * add note about missing arm support * simplify helper script syntax
35 lines
928 B
TypeScript
35 lines
928 B
TypeScript
import { env } from "./env.server";
|
|
import { requestUrl } from "./utils/requestUrl.server";
|
|
|
|
export type TriggerFeatures = {
|
|
isManagedCloud: boolean;
|
|
v3Enabled: boolean;
|
|
alertsEnabled: 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),
|
|
v3Enabled: env.V3_ENABLED === "true",
|
|
alertsEnabled: env.ALERT_FROM_EMAIL !== undefined && env.ALERT_RESEND_API_KEY !== undefined,
|
|
};
|
|
}
|
|
|
|
export function featuresForRequest(request: Request): TriggerFeatures {
|
|
const url = requestUrl(request);
|
|
return featuresForUrl(url);
|
|
}
|
|
|
|
export function featuresForUrl(url: URL): TriggerFeatures {
|
|
return featuresForHost(url.host);
|
|
}
|