chore: check added if ALLOWED_AUTH_PROVIDERS is there in the env file or not
This commit is contained in:
committed by
Andrew Bastin
parent
419e376f46
commit
2599b1d326
@@ -6,10 +6,21 @@ import { VersioningType } from '@nestjs/common';
|
|||||||
import * as session from 'express-session';
|
import * as session from 'express-session';
|
||||||
import { emitGQLSchemaFile } from './gql-schema';
|
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() {
|
async function bootstrap() {
|
||||||
console.log(`Running in production: ${process.env.PRODUCTION}`);
|
console.log(`Running in production: ${process.env.PRODUCTION}`);
|
||||||
console.log(`Port: ${process.env.PORT}`);
|
console.log(`Port: ${process.env.PORT}`);
|
||||||
|
|
||||||
|
checkRequiredEnvVars(['ALLOWED_AUTH_PROVIDERS']);
|
||||||
|
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
|
|||||||
Reference in New Issue
Block a user