| 1 | import * as Alchemy from "alchemy"; |
| 2 | import * as GCP from "alchemy/GCP"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import Api from "./src/Api.ts"; |
| 5 | import { ApiKey, Links } from "./src/resources.ts"; |
| 6 | |
| 7 | export default Alchemy.Stack( |
| 8 | "GcpCloudRunApiExample", |
| 9 | { providers: GCP.providers(), state: Alchemy.localState() }, |
| 10 | Effect.gen(function* () { |
| 11 | const links = yield* Links; |
| 12 | const apiKey = yield* ApiKey; |
| 13 | const api = yield* Api; |
| 14 | |
| 15 | return { |
| 16 | url: api.uri, |
| 17 | databaseId: links.databaseId, |
| 18 | databaseName: links.name, |
| 19 | // Seed the key with: |
| 20 | // printf 'my-key' | gcloud secrets versions add "$secretId" --data-file=- |
| 21 | secretId: apiKey.secretId, |
| 22 | secretName: apiKey.name, |
| 23 | }; |
| 24 | }), |
| 25 | ); |