| 1 | import * as Drizzle from "alchemy/Drizzle"; |
| 2 | import * as Fly from "alchemy/Fly"; |
| 3 | |
| 4 | export const API_PORT = 3000; |
| 5 | |
| 6 | /** |
| 7 | * Shared token for the fixture's `POST /migrate` route. Fly Managed |
| 8 | * Postgres is only reachable on the org's private network, so migrations |
| 9 | * are applied THROUGH the deployed Service (which is in-network) — the |
| 10 | * integ test reads the generated SQL locally and posts it here. A |
| 11 | * checked-in constant is fine for this throwaway demo database; real apps |
| 12 | * should use a deploy-time secret. |
| 13 | */ |
| 14 | export const MIGRATE_TOKEN = "fly-postgres-example-migrate"; |
| 15 | |
| 16 | /** |
| 17 | * Drizzle schema generation. The generated SQL under `./migrations` is |
| 18 | * applied through the Api service's `/migrate` route (see api.ts) — MPG |
| 19 | * hostnames don't resolve outside the org's private network, so the |
| 20 | * in-network Service is the data plane for DDL too. |
| 21 | */ |
| 22 | export const Schema = Drizzle.Schema("app-schema", { |
| 23 | schema: "./src/schema.ts", |
| 24 | out: "./migrations", |
| 25 | }); |
| 26 | |
| 27 | export const Db = Fly.Postgres("Db", { region: "iad" }); |
| 28 | |