diff --git a/.gitignore b/.gitignore index 4113ed5..0411e08 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,6 @@ Thumbs.db .nx/workspace-data .claude/worktrees .claude/settings.local.json + +# environment in dev +.env.local diff --git a/gateway/.env b/gateway/.env index 8210198..de4972c 100644 --- a/gateway/.env +++ b/gateway/.env @@ -1,4 +1,6 @@ # +# environment in ambiente di production +# PORT=3001 # KEYCLOAK_URL=http://localhost:8080 diff --git a/gateway/src/app/app.module.ts b/gateway/src/app/app.module.ts index 7c65ae5..7f668c0 100644 --- a/gateway/src/app/app.module.ts +++ b/gateway/src/app/app.module.ts @@ -1,26 +1,22 @@ import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { join } from 'path'; -import * as fs from 'fs'; import { AppService } from './app.service'; import { ShopController } from './shopController'; import { ConfigModule } from '@nestjs/config'; import { KeycloakModule } from '@appweb/module'; import { TraceMiddleware } from '../common/middleware/trace.middleware'; -const debugPath = join(__dirname, '..', 'environment', '.env'); -console.log('--- DEBUG ENV ---'); -console.log('CWD attuale:', process.cwd()); -console.log('Percorso calcolato:', debugPath); -console.log('Il file esiste?', fs.existsSync(debugPath)); -console.log('-----------------'); - @Module({ imports: [ // 1. Configurazione del ConfigModule con le tue specifiche ConfigModule.forRoot({ isGlobal: true, // Variabili disponibili ovunque cache: true, // Migliora le performance leggendo dal file solo una volta - envFilePath: join(process.cwd(), 'gateway/.env'), // Percorso del file (cercato nella root del workspace Nx) + envFilePath: [ + join(process.cwd(), 'apps/gateway/.env.local'), + join(process.cwd(), 'apps/gateway/.env'), + join(process.cwd(), '.env'), + ], }), KeycloakModule, ], diff --git a/user-service/.env b/user-service/.env index 0e56667..17bb1aa 100644 --- a/user-service/.env +++ b/user-service/.env @@ -1,4 +1,6 @@ # +# environment in ambiente di production +# PORT=3002 # # Base URL del server