From cf94d4b3cf83610e077920cda21d56f50653bbc4 Mon Sep 17 00:00:00 2001 From: cte Date: Wed, 14 May 2025 21:40:25 -0700 Subject: [PATCH] Clean up env vars --- .env | 8 ++------ .env.local.sample | 1 - .env.production | 33 --------------------------------- .github/workflows/CI.yml | 27 ++++++++++++++++++++++++++- src/lib/server/env.ts | 11 +---------- vitest-setup.ts | 3 --- 6 files changed, 29 insertions(+), 54 deletions(-) delete mode 100644 .env.production diff --git a/.env b/.env index bedfcf9eea..d090f6a723 100644 --- a/.env +++ b/.env @@ -1,5 +1,3 @@ -BILLING_PLAN_ENV=dev - VSCODE_EXTENSION_BASE_URL=vscode://RooVeterinaryInc.roo-cline CURSOR_EXTENSION_BASE_URL=cursor://RooVeterinaryInc.roo-cline @@ -14,7 +12,5 @@ NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/dashboard NEXT_PUBLIC_CLERK_FRONTEND_API=https://epic-chamois-85.clerk.accounts.dev NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_ZXBpYy1jaGFtb2lzLTg1LmNsZXJrLmFjY291bnRzLmRldiQ -# Stripe -NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51PNk4fKOp3DEwzQle6Cx1j3IW1Lze5nFKZ4JBX0gLpNQ3hjFbMiT25gw7LEr369ge7JIsVA2qRhdKQm1NAmVehXl00FQxwRfh1 -STRIPE_SECRET_KEY=your_stripe_secret_key -STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret +# ClickHouse +CLICKHOUSE_USERNAME=default diff --git a/.env.local.sample b/.env.local.sample index 14fbf342b2..3430599d24 100644 --- a/.env.local.sample +++ b/.env.local.sample @@ -1,5 +1,4 @@ CLERK_SECRET_KEY=your_clerk_secret_key CLICKHOUSE_URL=your_clickhouse_url -CLICKHOUSE_USERNAME=your_clickhouse_username CLICKHOUSE_PASSWORD=fake-your_clickhouse_password diff --git a/.env.production b/.env.production deleted file mode 100644 index 21038485b9..0000000000 --- a/.env.production +++ /dev/null @@ -1,33 +0,0 @@ -# FIXME: Configure environment variables for production - -# Hosting -# Replace by your domain name -# NEXT_PUBLIC_APP_URL=https://example.com - -# Sentry DSN -NEXT_PUBLIC_SENTRY_DSN= - -# Stripe -# If you need a real Stripe subscription payment with checkout page, customer portal, webhook, etc. -# You can check out the Next.js Boilerplate Pro: https://nextjs-boilerplate.com/pro-saas-starter-kit -NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live -# Use Stripe test mode price id or production price id -BILLING_PLAN_ENV=prod - -######## [BEGIN] SENSITIVE DATA ######## For security reason, don't update the following variables (secret key) directly in this file. -######## Please create a new file named `.env.production.local`, all environment files ending with `.local` won't be tracked by Git. -######## After creating the file, you can add the following variables. -# Database -# Using an incorrect DATABASE_URL value, Next.js build will timeout and you will get the following error: "because it took more than 60 seconds" -# DATABASE_URL=postgresql://postgres@localhost:5432/postgres - -# Stripe -STRIPE_SECRET_KEY=your_stripe_secret_key -STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret - -# Error monitoring -# SENTRY_AUTH_TOKEN= - -# Logging ingestion -# LOGTAIL_SOURCE_TOKEN= -######## [END] SENSITIVE DATA diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 791fee1573..4784af22c7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,8 +11,33 @@ env: PNPM_VERSION: 10.8.1 jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Build Next.js + run: pnpm build + test: - name: Run all tests runs-on: ubuntu-latest steps: diff --git a/src/lib/server/env.ts b/src/lib/server/env.ts index 82d02b9506..513e73d9fd 100644 --- a/src/lib/server/env.ts +++ b/src/lib/server/env.ts @@ -6,9 +6,6 @@ export const Env = createEnv({ CLERK_SECRET_KEY: z.string().min(1), DATABASE_URL: z.string().optional(), LOGTAIL_SOURCE_TOKEN: z.string().optional(), - STRIPE_SECRET_KEY: z.string().min(1), - STRIPE_WEBHOOK_SECRET: z.string().min(1), - BILLING_PLAN_ENV: z.enum(['dev', 'test', 'prod']), VSCODE_EXTENSION_BASE_URL: z.string().min(1), CURSOR_EXTENSION_BASE_URL: z.string().min(1), CLICKHOUSE_URL: z.string().min(1), @@ -24,19 +21,15 @@ export const Env = createEnv({ NEXT_PUBLIC_CLERK_SIGN_UP_URL: z.string().min(1), NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL: z.string().min(1), NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL: z.string().min(1), - NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.string().min(1), }, shared: { NODE_ENV: z.enum(['test', 'development', 'production']).optional(), }, - // You need to destructure all the keys manually + // You need to destructure all the keys manually. runtimeEnv: { CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY, DATABASE_URL: process.env.DATABASE_URL, LOGTAIL_SOURCE_TOKEN: process.env.LOGTAIL_SOURCE_TOKEN, - STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY, - STRIPE_WEBHOOK_SECRET: process.env.STRIPE_WEBHOOK_SECRET, - BILLING_PLAN_ENV: process.env.BILLING_PLAN_ENV, VSCODE_EXTENSION_BASE_URL: process.env.VSCODE_EXTENSION_BASE_URL, CURSOR_EXTENSION_BASE_URL: process.env.CURSOR_EXTENSION_BASE_URL, NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL, @@ -52,8 +45,6 @@ export const Env = createEnv({ process.env.NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL, NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL, - NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: - process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, NODE_ENV: process.env.NODE_ENV, CLICKHOUSE_URL: process.env.CLICKHOUSE_URL, CLICKHOUSE_USERNAME: process.env.CLICKHOUSE_USERNAME, diff --git a/vitest-setup.ts b/vitest-setup.ts index 528108d270..84135d937d 100644 --- a/vitest-setup.ts +++ b/vitest-setup.ts @@ -9,6 +9,3 @@ failOnConsole({ shouldFailOnLog: true, shouldFailOnWarn: true, }); - -// Set up environment variables for testing -process.env.BILLING_PLAN_ENV = 'test';