@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 31 lines 948 Bytes
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import * as Alchemy from "alchemy";
3 import * as Effect from "effect/Effect";
4 import Notes from "./src/Notes.ts";
5 import { NotesDb } from "./src/resources.ts";
6
7 export default Alchemy.Stack(
8 "GcpCloudFunctionExample",
9 { providers: GCP.providers(), state: Alchemy.localState() },
10 Effect.gen(function* () {
11 const db = yield* NotesDb;
12 const notes = yield* Notes;
13
14 // A 2nd-gen function is served by a Cloud Run service. Granting
15 // `roles/run.invoker` to `allUsers` on that service makes the API
16 // public; drop this and callers need a Google identity token.
17 yield* GCP.IAM.Member("PublicInvoker", {
18 kind: "run.service",
19 name: notes.service.as<string>(),
20 role: "roles/run.invoker",
21 member: "allUsers",
22 });
23
24 return {
25 url: notes.url,
26 functionName: notes.name,
27 serviceName: notes.service,
28 databaseName: db.name,
29 };
30 }),
31 );