diff --git a/infra/auth.ts b/infra/auth.ts index 560cc30d..c0f9c3ac 100644 --- a/infra/auth.ts +++ b/infra/auth.ts @@ -1,7 +1,7 @@ import { vpc } from "./vpc"; import { bus } from "./bus"; import { domain } from "./dns"; -import { email } from "./email"; +// import { email } from "./email"; import { secret } from "./secret"; import { postgres } from "./postgres"; @@ -19,7 +19,7 @@ export const auth = new sst.aws.Auth("Auth", { handler: "packages/functions/src/auth.handler", link: [ bus, - email, + // email, postgres, authFingerprintKey, secret.PolarSecret, diff --git a/infra/bus.ts b/infra/bus.ts index 70697f4e..c3ab4508 100644 --- a/infra/bus.ts +++ b/infra/bus.ts @@ -1,5 +1,5 @@ import { vpc } from "./vpc"; -import { email } from "./email"; +// import { email } from "./email"; import { allSecrets } from "./secret"; import { postgres } from "./postgres"; @@ -9,7 +9,7 @@ bus.subscribe("Event", { vpc, handler: "./packages/functions/src/event/event.handler", link: [ - email, + // email, postgres, ...allSecrets ], diff --git a/infra/email.ts b/infra/email.ts index e0dd84ed..33acca19 100644 --- a/infra/email.ts +++ b/infra/email.ts @@ -1,6 +1,6 @@ import { domain } from "./dns"; -export const email = new sst.aws.Email("Mail",{ - sender: domain, - dns: sst.cloudflare.dns(), -}) \ No newline at end of file +// export const email = new sst.aws.Email("Mail",{ +// sender: domain, +// dns: sst.cloudflare.dns(), +// }) \ No newline at end of file diff --git a/infra/postgres.ts b/infra/postgres.ts index 18854f5d..01b3910c 100644 --- a/infra/postgres.ts +++ b/infra/postgres.ts @@ -2,7 +2,7 @@ import { vpc } from "./vpc"; import { isPermanentStage } from "./stage"; // TODO: Add a dev db to use, this will help with running zero locally... and testing it -export const postgres = new sst.aws.Aurora("Postgres", { +export const postgres = new sst.aws.Aurora("Database", { vpc, engine: "postgres", scaling: isPermanentStage diff --git a/infra/vpc.ts b/infra/vpc.ts index 801c2117..1af7b7b7 100644 --- a/infra/vpc.ts +++ b/infra/vpc.ts @@ -1,17 +1,11 @@ -// import { isPermanentStage } from "./stage"; +import { isPermanentStage } from "./stage"; -// export const vpc = isPermanentStage -// ? new sst.aws.Vpc("Vpc", { -// az: 2, -// }) -// //FIXME: Change this ID -// : undefined //sst.aws.Vpc.get("Vpc", "vpc-070a1a7598f4c12d1"); -// // - -export const vpc = new sst.aws.Vpc("NestriVpc", { - az: 2, - // For lambdas to work in this VPC - nat: "ec2", - // For SST tunnel to work - bastion: true -}) \ No newline at end of file +export const vpc = isPermanentStage + ? new sst.aws.Vpc("VPC", { + az: 2, + // For lambdas to work in this VPC + nat: "ec2", + // For SST tunnel to work + bastion: true, + }) + : sst.aws.Vpc.get("VPC", "vpc-0beb1cdc21a725748"); \ No newline at end of file diff --git a/packages/core/drizzle.config.ts b/packages/core/drizzle.config.ts index e6db3352..71ca5803 100644 --- a/packages/core/drizzle.config.ts +++ b/packages/core/drizzle.config.ts @@ -2,9 +2,9 @@ import { Resource } from "sst"; import { defineConfig } from "drizzle-kit"; const connection = { - user: Resource.Postgres.username, - password: Resource.Postgres.password, - host: Resource.Postgres.host, + user: Resource.Database.username, + password: Resource.Database.password, + host: Resource.Database.host, }; export default defineConfig({ diff --git a/packages/core/src/drizzle/index.ts b/packages/core/src/drizzle/index.ts index 6259b92d..d4865785 100644 --- a/packages/core/src/drizzle/index.ts +++ b/packages/core/src/drizzle/index.ts @@ -6,11 +6,11 @@ import { drizzle } from "drizzle-orm/postgres-js"; const client = postgres({ idle_timeout: 30000, connect_timeout: 30000, - host: Resource.Postgres.host, - database: Resource.Postgres.database, - user: Resource.Postgres.username, - password: Resource.Postgres.password, - port: Resource.Postgres.port, + host: Resource.Database.host, + database: Resource.Database.database, + user: Resource.Database.username, + password: Resource.Database.password, + port: Resource.Database.port, max: parseInt(process.env.POSTGRES_POOL_MAX || "1"), }); diff --git a/packages/functions/sst-env.d.ts b/packages/functions/sst-env.d.ts index 94b4a902..b3ba1db8 100644 --- a/packages/functions/sst-env.d.ts +++ b/packages/functions/sst-env.d.ts @@ -28,13 +28,6 @@ declare module "sst" { "name": string "type": "sst.aws.Bus" } - "Database": { - "host": string - "name": string - "password": string - "type": "sst.sst.Linkable" - "user": string - } "DatabaseMigrator": { "name": string "type": "sst.aws.Function" diff --git a/sst-env.d.ts b/sst-env.d.ts index 94b4a902..b3ba1db8 100644 --- a/sst-env.d.ts +++ b/sst-env.d.ts @@ -28,13 +28,6 @@ declare module "sst" { "name": string "type": "sst.aws.Bus" } - "Database": { - "host": string - "name": string - "password": string - "type": "sst.sst.Linkable" - "user": string - } "DatabaseMigrator": { "name": string "type": "sst.aws.Function" diff --git a/sst.config.ts b/sst.config.ts index e7c27009..e0cc2f25 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -15,7 +15,6 @@ export default $config({ }, cloudflare: "5.49.0", random: "4.17.0", - neon: "0.6.3", command: "1.0.2", }, };