Questions tagged [nestjs-config]

196 questions
4
votes
3 answers

How to override an imported module in nestjs testing?

I'm quite new on nestjs, met an issue regarding how to override the load function of ConfigModule, hope someone can help me out, thanks in advance! My e2e testing: const moduleForTesting = await Test.createTestingModule({imports: [AppModule]}); My…
Jeff Tian
  • 5,210
  • 3
  • 51
  • 71
4
votes
1 answer

Nestjs: How to remove particular app from nestjs monorepo with nest/cli

Is there way to remove particular app in nestjs monorepo using nest/cli? I couldn't find it from the documentation and dev forum.
SKL
  • 1,243
  • 4
  • 32
  • 53
4
votes
1 answer

How to handle multiple middlewares in NEST JS for specific/different request methods?

Explaining my code below: There are two middleware AuthenticationMiddleware, RequestFilterMiddleware which intervene ALL request methods. My question is how to make RequestFilterMiddleware middleware only for GET method and…
Vignesh
  • 234
  • 1
  • 3
  • 12
3
votes
2 answers

How to set run time variable to postgresql in typeorm and nest js

Iam using the row level security in supabase with nest.js, So how can I set runtime variables safely to the DB so that I can be sure that the variables sync with each app user (due to the http request triggered the execution)? I saw that it is…
3
votes
0 answers

Setup & configure NestJS 9 (TypeORM 0.3+) to use custom repositories

I am currently attempting to update my project to the latest version of NestJS and TypeORM and I am having a great deal of difficulty wrapping my head around how to setup the project so that I can use custom repositories in a similar way that it was…
3
votes
3 answers

NestJS: How to customise log messages to include request id and name of the file the log message occurred

I am new to NestJS and would like to customise the log messages to include the x-request-id/x-correlation-id and the name of the file the log message originated but am not sure if there is anything in NestJS to do that. My application is using…
mh377
  • 1,656
  • 5
  • 22
  • 41
3
votes
1 answer

Conditionally disable controller endpoints and remove exports using value from configuration service using nestjs

I would like to disable module (or all endpoints and exported services) using environment feature flags. I have a configuration file which looks like this: { "featureFlags": { "books": true, "cars": false } } In my app.module.ts I have the…
jm18457
  • 443
  • 1
  • 7
  • 19
3
votes
1 answer

How to use environment variables in ClientsModule?

I'm trying to use environment variables in the ClientsModule as such: import { Module } from '@nestjs/common'; import { ClientsModule, Transport } from '@nestjs/microservices'; @Module({ imports: [ TypeOrmModule.forFeature([Process]), …
Vitor
  • 130
  • 1
  • 9
3
votes
2 answers

How write schedulers using NestJS for multiple countries at 12:00AM(will be same in all timezone)?

I have a scheduler that has to run on 12:00 AM of Indian time zone and 12:00 AM of Singapore timezone. I was able to write a cron job for Indian users, But how to trigger the same in Singapore at 12:00 AM?
Balaji Venkatraman
  • 1,228
  • 12
  • 19
3
votes
1 answer

How to implement database first approach in Nest JS

I have three schemas(User, Account, Contact) these three schemas used to created a model and generate the migration files also Next, this migration file migrate the PostgreSQL Database this part successfully completed using Nest JS. Next, Manually I…
3
votes
0 answers

NEST JS module register error with new connection

Hi im trying to create a new module with connected a new database, but its shows me an error: //module @Module({ imports: [CoffeesModule, DatabaseModule.register({ // passing in dynamic values type: 'postgres', …
Daniel ORTIZ
  • 2,488
  • 3
  • 21
  • 41
3
votes
1 answer

How to set up Angular-like configuration environment files in NestJS?

Does NestJS allow to have environment files in a similar way as Angular has? In angular you have separate environment files which are mapped automatically depending on application environment (development, production,…
3
votes
4 answers

How to inject the path configuration into ServeStaticModule from another service?

The NestJS documentation says to serve static files like this: import { Module } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service'; import { ServeStaticModule } from…
JBCP
  • 13,109
  • 9
  • 73
  • 111
2
votes
1 answer

Warnings "use @jridgewell/sourcemap-codec instead" and "deprecated rimraf" after global installation of NestJS 9.2

I installed NestJS (v. 9.2) globally and received the following warnings: npm i -g @nestjs/cli npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead npm WARN deprecated rimraf@4.1.2: Please upgrade to 4.3.1 or…
r00k13
  • 215
  • 3
  • 15
2
votes
1 answer

Nestjs can't create dynamic module with config import

I am trying to create a DynamicModule in Nestjs, but it seems I can't properly use useFactory to inject ConfigModule in the process. If I use a hardcoded boolean instead of config.get('cache').enabled everything works as expected, but I receive the…
1
2
3
13 14