* chore: enable apiv2 auth with api keys * chore: enable apiv2 auth with api keys * chore: enable apiv2 auth with api keys * chore: enable apiv2 auth with api keys * chore: enable apiv2 auth with api keys * fixup! chore: enable apiv2 auth with api keys * fixup! Merge branch 'chore-apiv2-auth-api-key' of github.com:calcom/cal.com into chore-apiv2-auth-api-key * fixup! fixup! Merge branch 'chore-apiv2-auth-api-key' of github.com:calcom/cal.com into chore-apiv2-auth-api-key * fixup! fixup! fixup! Merge branch 'chore-apiv2-auth-api-key' of github.com:calcom/cal.com into chore-apiv2-auth-api-key
36 lines
880 B
TypeScript
36 lines
880 B
TypeScript
import { logLevels } from "@/lib/logger";
|
|
|
|
export type Environment = {
|
|
NODE_ENV: "development" | "production";
|
|
API_PORT: string;
|
|
API_URL: string;
|
|
DATABASE_READ_URL: string;
|
|
DATABASE_WRITE_URL: string;
|
|
NEXTAUTH_SECRET: string;
|
|
DATABASE_URL: string;
|
|
JWT_SECRET: string;
|
|
SENTRY_DSN: string;
|
|
LOG_LEVEL: keyof typeof logLevels;
|
|
REDIS_URL: string;
|
|
STRIPE_API_KEY: string;
|
|
STRIPE_WEBHOOK_SECRET: string;
|
|
WEB_APP_URL: string;
|
|
IS_E2E: boolean;
|
|
CALCOM_LICENSE_KEY: string;
|
|
GET_LICENSE_KEY_URL: string;
|
|
API_KEY_PREFIX: string;
|
|
};
|
|
|
|
export const getEnv = <K extends keyof Environment>(key: K, fallback?: Environment[K]): Environment[K] => {
|
|
const value = process.env[key] as Environment[K] | undefined;
|
|
|
|
if (!value) {
|
|
if (fallback) {
|
|
return fallback;
|
|
}
|
|
throw new Error(`Missing environment variable: ${key}.`);
|
|
}
|
|
|
|
return value;
|
|
};
|