Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 1 addition & 27 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,7 @@ import { EscrowsModule } from './modules/escrows/escrows.module';
type: 'postgres',
url: process.env.DATABASE_URL,
ssl: process.env.DB_SSL === 'true' ? { rejectUnauthorized: false } : undefined,
Comment on lines 59 to 60
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Replace direct process.env access with config object.

Direct access to process.env violates the coding guidelines. Environment variables should be accessed via the config object from src/config/env.

As per coding guidelines, import and use the config object:

+import { config } from './config/env';
+
 import './config/crypto-global';
 import { Module } from '@nestjs/common';

Then update the TypeOrmModule configuration:

     TypeOrmModule.forRoot({
       type: 'postgres',
-      url: process.env.DATABASE_URL,
-      ssl: process.env.DB_SSL === 'true' ? { rejectUnauthorized: false } : undefined,
+      url: config.DATABASE_URL,
+      ssl: config.DB_SSL === 'true' ? { rejectUnauthorized: false } : undefined,
   // entities property removed for modularization. Now entities are loaded via TypeOrmModule.forFeature in each feature module.
       synchronize: false,
-      logging: process.env.NODE_ENV === 'development',
+      logging: config.NODE_ENV === 'development',
     }),

Also applies to: 63-63

πŸ€– Prompt for AI Agents
In src/app.module.ts around lines 59-60 (also apply to line 63), replace direct
process.env usage with the project's config object from src/config/env: import
the config instance at the top of the file, then use config.get('DATABASE_URL')
in place of process.env.DATABASE_URL and use config.get('DB_SSL') === 'true' (or
a boolean helper from the config if available) to decide the ssl value instead
of process.env.DB_SSL; update the TypeOrmModule configuration accordingly so ssl
is set to { rejectUnauthorized: false } when the config indicates true and
undefined otherwise, and make the same replacement for the other occurrence on
line 63.

entities: [
User,
Order,
OrderItem,
UserRole,
Role,
Notification,
Wishlist,
Product,
ProductType,
ProductVariant,
Attribute,
AttributeValue,
Coupon,
CouponUsage,
BuyerRequest,
Offer,
OfferAttachment,
EscrowAccount,
Milestone,

Escrow,
EscrowFundingTx,
Store,
Escrow,
Milestone,
],
// entities property removed for modularization. Now entities are loaded via TypeOrmModule.forFeature in each feature module.
synchronize: false,
logging: process.env.NODE_ENV === 'development',
}),
Expand Down