| 1 | import * as GCP from "alchemy/GCP"; |
| 2 | |
| 3 | /** |
| 4 | * One Firestore document per short link, at `links/{code}`. Firestore is |
| 5 | * the default datastore for a Cloud Run app: no instance to size, no VPC |
| 6 | * to attach, and it is reachable over the same googleapis endpoint the |
| 7 | * rest of the bindings use. |
| 8 | */ |
| 9 | export const Links = GCP.Firestore.Database("Links", { |
| 10 | type: "FIRESTORE_NATIVE", |
| 11 | }); |
| 12 | |
| 13 | /** |
| 14 | * The key callers must present to create a link. Only the container ever |
| 15 | * reads it — the value never appears in the stack, in an env var set by |
| 16 | * hand, or in `alchemy deploy` output. |
| 17 | * |
| 18 | * Alchemy creates the secret; adding the *version* that holds the value |
| 19 | * is an operator step, exactly as in production: |
| 20 | * |
| 21 | * ```sh |
| 22 | * printf 'my-key' | gcloud secrets versions add "$SECRET_ID" --data-file=- |
| 23 | * ``` |
| 24 | */ |
| 25 | export const ApiKey = GCP.SecretManager.Secret("ApiKey", {}); |