import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import * as dotenv from "dotenv";
dotenv.config({ path: ".env.variable" });
dotenv.config({ path: ".env.constants" });

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  // Set 'trust proxy' using the underlying Express instance
  const expressApp = app.getHttpAdapter().getInstance();
  expressApp.set("trust proxy", true);
  app.enableCors({
    origin: [
      "http://192.168.1.23",
      "https://dev-hms.plenome.com",
      "https://qa-hms.plenome.com",
      "https://demo-hms.plenome.com",
      "https://loadtest-hms.plenome.com",
      "https://uat-hms.plenome.com",
      "https://mountmsh.plenome.com",
    ],
    credentials: true,
    methods: "GET,POST,PUT",
  });
  await app.listen(7000);
  console.log("CONNECTED SUCCESSFULLY");
}
bootstrap();
