| 1 | import * as Fly from "@/Fly"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as HttpServerResponse from "effect/http/HttpServerResponse"; |
| 4 | |
| 5 | export const SECURE_USERS_BODY = "users-on-the-stack-network"; |
| 6 | |
| 7 | /** |
| 8 | * Private Service on the stack's own network: only Services on that |
| 9 | * network can resolve it. |
| 10 | */ |
| 11 | export default class SecureUsers extends Fly.Service<SecureUsers>()( |
| 12 | "SecureUsers", |
| 13 | Effect.gen(function* () { |
| 14 | return { |
| 15 | main: import.meta.url, |
| 16 | region: "iad", |
| 17 | public: false, |
| 18 | network: yield* Fly.stackNetwork, |
| 19 | guest: { cpuKind: "shared" as const, cpus: 1, memoryMb: 256 }, |
| 20 | }; |
| 21 | }), |
| 22 | Effect.gen(function* () { |
| 23 | return { |
| 24 | fetch: Effect.succeed(HttpServerResponse.text(SECURE_USERS_BODY)), |
| 25 | }; |
| 26 | }), |
| 27 | ) {} |