changed imports
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createParamDecorator, ExecutionContext, MiddlewareConsumer, Module } from '@nestjs/common';
|
||||
import { MiddlewareConsumer, Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { utilities as nestWinstonModuleUtilities, WinstonModule } from 'nest-winston';
|
||||
@@ -18,45 +18,11 @@ import dotenvFlow from 'dotenv-flow';
|
||||
import { EventModule } from './event/event.module';
|
||||
import { JwtStrategy } from './jwt.strategy';
|
||||
import { MailModule } from './mail/mail.module';
|
||||
import { RealIpInfo } from './models/main.model';
|
||||
|
||||
import { PaymentModule } from './payment/payment.module';
|
||||
import { RequestDurationMiddleware } from './request-duration/request-duration.middleware';
|
||||
import { SelectOptionsModule } from './select-options/select-options.module';
|
||||
import { UserModule } from './user/user.module';
|
||||
export const RealIp = createParamDecorator((data: unknown, ctx: ExecutionContext): RealIpInfo => {
|
||||
const request = ctx.switchToHttp().getRequest();
|
||||
const ip = request.headers['cf-connecting-ip'] || request.headers['x-real-ip'] || request.headers['x-forwarded-for']?.split(',')[0] || request.connection.remoteAddress;
|
||||
const countryCode = request.headers['cf-ipcountry'];
|
||||
return { ip, countryCode };
|
||||
});
|
||||
// function loadEnvFiles() {
|
||||
// // Determine which additional env file to load
|
||||
// let envFilePath = '';
|
||||
// const host = process.env.HOST_NAME || '';
|
||||
|
||||
// if (host.includes('localhost')) {
|
||||
// envFilePath = '.env.local';
|
||||
// } else if (host.includes('dev.bizmatch.net')) {
|
||||
// envFilePath = '.env.dev';
|
||||
// } else if (host.includes('www.bizmatch.net') || host.includes('bizmatch.net')) {
|
||||
// envFilePath = '.env.prod';
|
||||
// }
|
||||
|
||||
// // Load the additional env file if it exists
|
||||
// if (fs.existsSync(envFilePath)) {
|
||||
// dotenv.config({ path: envFilePath });
|
||||
// console.log(`Loaded ${envFilePath} file`);
|
||||
// } else {
|
||||
// console.log(`No additional .env file found for HOST_NAME: ${host}`);
|
||||
// }
|
||||
|
||||
// // Load the .env file
|
||||
// dotenv.config();
|
||||
// console.log('Loaded .env file');
|
||||
// // Output all loaded environment variables
|
||||
// console.log('Loaded environment variables:');
|
||||
// console.log(JSON.stringify(process.env, null, 2));
|
||||
// }
|
||||
|
||||
//loadEnvFiles();
|
||||
dotenvFlow.config();
|
||||
|
||||
Reference in New Issue
Block a user