diff --git a/.github/workflows/cleanup-projects.yml b/.github/workflows/cleanup-projects.yml index 604b4f2..1e05103 100644 --- a/.github/workflows/cleanup-projects.yml +++ b/.github/workflows/cleanup-projects.yml @@ -18,5 +18,5 @@ jobs: - name: Cleanup Projects env: DATABASE_URL: ${{ secrets.DATABASE_URL }} - NEON_API_KEY: ${{ secrets.NEON_API_KEY }} + INSTANT_POSTGRES_API_KEY: ${{ secrets.INSTANT_POSTGRES_API_KEY }} run: bun run packages/db/src/cleanup-projects.ts \ No newline at end of file diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml index 0caaf25..83024fa 100644 --- a/.github/workflows/deploy-api.yml +++ b/.github/workflows/deploy-api.yml @@ -10,7 +10,7 @@ on: env: DATABASE_URL: ${{ secrets.DATABASE_URL }} COOKIE_SECRET: ${{ secrets.COOKIE_SECRET }} - NEON_API_KEY: ${{ secrets.NEON_API_KEY }} + INSTANT_POSTGRES_API_KEY: ${{ secrets.INSTANT_POSTGRES_API_KEY }} APP_URL: ${{ secrets.APP_URL }} CLOUDFLARE_TURNSTILE_SECRET_KEY: ${{ secrets.CLOUDFLARE_TURNSTILE_SECRET_KEY }} UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }} @@ -39,7 +39,7 @@ jobs: echo "{ \"DATABASE_URL\": \"${{ secrets.DATABASE_URL }}\", \"COOKIE_SECRET\": \"${{ secrets.COOKIE_SECRET }}\", - \"NEON_API_KEY\": \"${{ secrets.NEON_API_KEY }}\", + \"INSTANT_POSTGRES_API_KEY\": \"${{ secrets.INSTANT_POSTGRES_API_KEY }}\", \"APP_URL\": \"${{ secrets.APP_URL }}\", \"CLOUDFLARE_TURNSTILE_SECRET_KEY\": \"${{ secrets.CLOUDFLARE_TURNSTILE_SECRET_KEY }}\", \"UPSTASH_REDIS_REST_URL\": \"${{ secrets.UPSTASH_REDIS_REST_URL }}\", diff --git a/apps/api/.dev.vars.example b/apps/api/.dev.vars.example index e26a94e..09967c1 100644 --- a/apps/api/.dev.vars.example +++ b/apps/api/.dev.vars.example @@ -1,7 +1,7 @@ COOKIE_SECRET= DATABASE_URL= -NEON_API_KEY= APP_URL=http://localhost:3000 CLOUDFLARE_TURNSTILE_SECRET_KEY= UPSTASH_REDIS_REST_URL= -UPSTASH_REDIS_REST_TOKEN= \ No newline at end of file +UPSTASH_REDIS_REST_TOKEN= +INSTANT_POSTGRES_API_KEY= \ No newline at end of file diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 7ab8755..178efab 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -104,7 +104,7 @@ const route = app.post( ); } - const neonApiClient = neon(c.env.NEON_API_KEY); + const neonApiClient = neon(c.env.INSTANT_POSTGRES_API_KEY); const start = Date.now(); diff --git a/apps/api/src/types.ts b/apps/api/src/types.ts index 32499cc..b600b41 100644 --- a/apps/api/src/types.ts +++ b/apps/api/src/types.ts @@ -2,12 +2,12 @@ import type { schema } from "@instant-postgres/neon"; export type Bindings = { DATABASE_URL: string; - NEON_API_KEY: string; COOKIE_SECRET: string; APP_URL: string; CLOUDFLARE_TURNSTILE_SECRET_KEY: string; UPSTASH_REDIS_REST_URL: string; UPSTASH_REDIS_REST_TOKEN: string; + INSTANT_POSTGRES_API_KEY: string; }; export type SuccessResponse = { diff --git a/apps/web/app/components/deploy-button.tsx b/apps/web/app/components/deploy-button.tsx index 27be84e..bc38bf5 100644 --- a/apps/web/app/components/deploy-button.tsx +++ b/apps/web/app/components/deploy-button.tsx @@ -88,7 +88,7 @@ export const DeployButton = () => { setToken(token)} /> diff --git a/packages/db/src/cleanup-projects.ts b/packages/db/src/cleanup-projects.ts index bc5c253..5479e1f 100644 --- a/packages/db/src/cleanup-projects.ts +++ b/packages/db/src/cleanup-projects.ts @@ -5,7 +5,7 @@ import { and, sql } from "drizzle-orm"; import { db } from "."; const DATABASE_URL = process.env.DATABASE_URL; -const NEON_API_KEY = process.env.NEON_API_KEY; +const INSTANT_POSTGRES_API_KEY = process.env.INSTANT_POSTGRES_API_KEY; const fetchOldProjects = async (client: NeonDriver["client"]) => { const fiveMinutesAgo = sql`now() - interval '5 minutes'`; @@ -52,12 +52,14 @@ const markProjectsAsDeleted = async (client: NeonDriver["client"]) => { const main = async () => { try { - if (!DATABASE_URL || !NEON_API_KEY) { - throw new Error("Missing DATABASE_URL or NEON_API_KEY env var"); + if (!DATABASE_URL || !INSTANT_POSTGRES_API_KEY) { + throw new Error( + "Missing DATABASE_URL or INSTANT_POSTGRES_API_KEY env var", + ); } const client = db(DATABASE_URL); - const neonApiClient = neon(NEON_API_KEY); + const neonApiClient = neon(INSTANT_POSTGRES_API_KEY); const oldProjects = await fetchOldProjects(client);