fix: cleanup env variables

This commit is contained in:
David Nguyen
2025-02-13 20:56:44 +11:00
parent 7379391f92
commit 92db4d68db
31 changed files with 29 additions and 439 deletions

View File

@ -1 +0,0 @@
export { createNextRouter } from '@ts-rest/next';

View File

@ -1,4 +1,5 @@
import { env } from '../utils/env';
import { NEXT_PUBLIC_WEBAPP_URL } from './app';
export const SALT_ROUNDS = 12;
@ -49,7 +50,7 @@ export const MAXIMUM_PASSKEYS = 50;
// Todo: nextuauth_url ??
export const useSecureCookies =
env('NODE_ENV') === 'production' && String(env('NEXTAUTH_URL')).startsWith('https://');
env('NODE_ENV') === 'production' && String(NEXT_PUBLIC_WEBAPP_URL()).startsWith('https://');
// Todo: Test secure cookies prefix in remix.
const secureCookiePrefix = useSecureCookies ? '__Secure-' : '';

View File

@ -34,8 +34,6 @@
"@pdf-lib/fontkit": "^1.1.1",
"@scure/base": "^1.1.3",
"@sindresorhus/slugify": "^2.2.1",
"@trigger.dev/sdk": "^2.3.18",
"@upstash/redis": "^1.20.6",
"@vvo/tzdb": "^6.117.0",
"csv-parse": "^5.6.0",
"inngest": "^3.19.13",
@ -59,4 +57,4 @@
"@types/luxon": "^3.3.1",
"@types/pg": "^8.11.4"
}
}
}

View File

@ -1,10 +0,0 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import { Redis } from '@upstash/redis';
import { env } from '../../utils/env';
// !: We're null coalescing here because we don't want local builds to fail.
export const redis = new Redis({
url: env('NEXT_PRIVATE_REDIS_URL') ?? '',
token: env('NEXT_PRIVATE_REDIS_TOKEN') ?? '',
});

View File

@ -1,25 +0,0 @@
import type { User as PrismaUser } from '@prisma/client';
import type { DefaultUser } from 'next-auth';
declare module 'next-auth' {
interface Session {
user: User;
}
interface User extends Omit<DefaultUser, 'id' | 'image' | 'emailVerified'> {
id: PrismaUser['id'];
name?: PrismaUser['name'];
email?: PrismaUser['email'];
emailVerified?: string | null;
}
}
declare module 'next-auth/jwt' {
interface JWT {
id: string | number;
name?: string | null;
email: string | null;
emailVerified?: string | null;
lastSignedIn?: string | null;
}
}

View File

@ -7,10 +7,6 @@ export const getBaseUrl = () => {
return '';
}
if (env('VERCEL_URL')) {
return `https://${env('VERCEL_URL')}`;
}
const webAppUrl = NEXT_PUBLIC_WEBAPP_URL();
if (webAppUrl) {

View File

@ -17,11 +17,10 @@
"@trpc/react-query": "11.0.0-rc.648",
"@trpc/server": "11.0.0-rc.648",
"@ts-rest/core": "^3.30.5",
"@ts-rest/next": "^3.30.5",
"luxon": "^3.4.0",
"superjson": "^1.13.1",
"trpc-to-openapi": "2.0.4",
"ts-pattern": "^5.0.5",
"zod": "3.24.1"
}
}
}

View File

@ -1 +0,0 @@
export * from '@trpc/server/adapters/next';

View File

@ -3,9 +3,9 @@ import SuperJSON from 'superjson';
import type { AnyZodObject } from 'zod';
import { AppError, genericErrorCodeToTrpcErrorCodeMap } from '@documenso/lib/errors/app-error';
import { isAdmin } from '@documenso/lib/next-auth/guards/is-admin';
import { getApiTokenByToken } from '@documenso/lib/server-only/public-api/get-api-token-by-token';
import type { ApiRequestMetadata } from '@documenso/lib/universal/extract-request-metadata';
import { isAdmin } from '@documenso/lib/utils/is-admin';
import type { TrpcContext } from './context';

View File

@ -17,8 +17,6 @@ declare namespace NodeJS {
NEXT_PRIVATE_ENCRYPTION_KEY: string;
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY: string;
NEXT_PUBLIC_STRIPE_COMMUNITY_PLAN_MONTHLY_PRICE_ID: string;
NEXT_PRIVATE_STRIPE_API_KEY: string;
NEXT_PRIVATE_STRIPE_WEBHOOK_SECRET: string;
@ -69,16 +67,9 @@ declare namespace NodeJS {
NEXT_PUBLIC_DISABLE_SIGNUP?: string;
//
NEXT_PRIVATE_BROWSERLESS_URL?: string;
NEXT_PRIVATE_JOBS_PROVIDER?: 'trigger' | 'inngest' | 'local';
/**
* Trigger.dev environment variables
*/
NEXT_PRIVATE_TRIGGER_API_KEY?: string;
NEXT_PRIVATE_TRIGGER_API_URL?: string;
NEXT_PRIVATE_JOBS_PROVIDER?: 'inngest' | 'local';
/**
* Inngest environment variables
@ -90,17 +81,6 @@ declare namespace NodeJS {
NEXT_PRIVATE_LOGGER_HONEY_BADGER_API_KEY?: string;
/**
* Vercel environment variables
*/
VERCEL?: string;
VERCEL_ENV?: 'production' | 'development' | 'preview';
VERCEL_URL?: string;
DEPLOYMENT_TARGET?: 'webapp' | 'marketing';
FONT_CAVEAT_URI: string;
FONT_NOTO_SANS_URI: string;
POSTGRES_URL?: string;
DATABASE_URL?: string;
POSTGRES_PRISMA_URL?: string;