chore: check added if ALLOWED_AUTH_PROVIDERS is there in the env file or not

This commit is contained in:
Mir Arif Hasan
2023-08-01 20:45:55 +06:00
committed by Andrew Bastin
parent 419e376f46
commit 2599b1d326

View File

@@ -6,10 +6,21 @@ import { VersioningType } from '@nestjs/common';
import * as session from 'express-session';
import { emitGQLSchemaFile } from './gql-schema';
function checkRequiredEnvVars(requiredEnvVariables: string[]) {
for (const envVar of requiredEnvVariables) {
if (!process.env[envVar]) {
console.error(`Environment variable "${envVar}" is missing or not set.`);
process.exit(1); // Exit the application with a non-zero status code to indicate an error
}
}
}
async function bootstrap() {
console.log(`Running in production: ${process.env.PRODUCTION}`);
console.log(`Port: ${process.env.PORT}`);
checkRequiredEnvVars(['ALLOWED_AUTH_PROVIDERS']);
const app = await NestFactory.create(AppModule);
app.use(