| 1 | import * as Alchemy from "alchemy"; |
| 2 | import * as AWS from "alchemy/AWS"; |
| 3 | import * as Output from "alchemy/Output"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | import { NetworkLive } from "./src/Network.ts"; |
| 6 | import Server from "./src/Server.ts"; |
| 7 | |
| 8 | export default Alchemy.Stack( |
| 9 | "AwsEc2Example", |
| 10 | { |
| 11 | providers: AWS.providers(), |
| 12 | state: Alchemy.localState(), |
| 13 | }, |
| 14 | Effect.gen(function* () { |
| 15 | const instance = yield* Server; |
| 16 | |
| 17 | return { |
| 18 | instanceId: instance.instanceId, |
| 19 | publicIpAddress: instance.publicIpAddress, |
| 20 | instanceUrl: Output.interpolate`http://${instance.publicIpAddress}:3000`, |
| 21 | enqueueExample: Output.interpolate`http://${instance.publicIpAddress}:3000/enqueue?message=hello`, |
| 22 | }; |
| 23 | }).pipe(Effect.provide(NetworkLive)), |
| 24 | ); |