@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 46 lines 1.68 KB
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2
3 /**
4 * Cloudflare zone the example operates on. The same zone is used for
5 * inbound (Email Routing) and outbound (`send_email` sender domain).
6 */
7 export const ZONE = "alchemy-test-2.us";
8
9 /**
10 * `from:` address the Worker is allowed to send mail as. Must live on a
11 * sender domain with Email Routing enabled — the `Cloudflare.email(...)`
12 * subscribe in `Api.ts` auto-creates the `EmailRouting` toggle for us.
13 */
14 export const SENDER = process.env.CLOUDFLARE_EMAIL_FROM ?? `bot@${ZONE}`;
15
16 /**
17 * Destination the Worker is pinned to send to. Cloudflare requires this
18 * address to be verified (recipient clicks a confirmation link) before
19 * `send_email` will deliver.
20 */
21 export const DESTINATION = process.env.CLOUDFLARE_EMAIL_TO ?? "michael@alchemy.run";
22
23 /**
24 * Inbox address the Worker subscribes to. Mail addressed here is routed
25 * to the Worker's `email` handler via the `EmailRule` that the
26 * `Cloudflare.email({ zone, matchers }).subscribe(...)` call auto-creates.
27 */
28 export const INBOX = process.env.CLOUDFLARE_EMAIL_INBOX ?? `inbox@${ZONE}`;
29
30 /**
31 * Register the destination address on the account. Cloudflare emails a
32 * verification link the first time this address is added; until the
33 * recipient clicks it, `send_email` calls targeting it will fail.
34 */
35 export const Destination = Cloudflare.Email.Address("Destination", {
36 email: DESTINATION,
37 });
38
39 /**
40 * `send_email` Worker binding restricted to the sender/destination pair
41 * above so the Worker can't be tricked into emailing arbitrary recipients.
42 */
43 export const SendEmail = Cloudflare.Email.SendEmail("Email", {
44 allowedSenderAddresses: [SENDER],
45 destinationAddress: DESTINATION,
46 });