Questions tagged [nestjs-config]

196 questions
0
votes
1 answer

Nestjs versioning configuration when using Fastify

For performance reasons of a relatively complex Nestjs application, we have chosen to use Fastify as our HTTP provider. We are at a stage where we need to version out api and are running into problems after following instructions on the standard…
Mr Citizen
  • 37
  • 1
  • 5
0
votes
2 answers

Nest js passing dynamic object from controller to service without using parameter

I'm using nest js.I have the following scenario where i need to pass customId from controller where i got it using interceptor when i handled the http request. I need to access customId in service without passing it in the props. Is their a way to…
0
votes
2 answers

Accessing local .env variables from a custom function within nestjs

I have an .env.development file with the following variables DB_NAME=db.sqlite COOKIE_KEY=sdfjshdfjsf For this I have created a setup-app.ts file with the setupApp function, where I defined a cookie keys value: import { ValidationPipe } from…
r00k13
  • 215
  • 3
  • 15
0
votes
1 answer

Inject ConfigService in sub module

I'm new with NestJS and trying to understand the patterns. I configure ConfigModule to use config set in a specific folder. I want to use that ConfigModule in a submodule but It doesn't work. I have an app.module app.module.ts @Module({ imports:…
Sancho
  • 1,288
  • 2
  • 25
  • 50
0
votes
0 answers

upload excel data into database using nestjs

I have to upload data of file into postgres database using nestjs. below is the method which I am writing. @Post('upload') @UseInterceptors(FileInterceptor('file', multerOptions)) @UseInterceptors(FileInterceptor('file')) …
Shruti sharma
  • 199
  • 6
  • 21
  • 67
0
votes
0 answers

How to get User Access Control in NestJs Guard for authorizations?

I am new in @Nestjs. I am using graphql in @Nestjs. I have a question in this field. How can I access UserSchema or UserModel from AuthGuard.ts? Here in AuthGuard.ts I am checking request context headers is and verify jwt token- import { Injectable,…
0
votes
1 answer

npm install @nestjs/config fails with npm ERR! Unexpected end of JSON input while parsing

I tried installing npm as described by the documentation using npm install @nestjs/config and the installation process failed. I got an error message: npm ERR! Unexpected end of JSON input while parsing near '....0","lodash.get":"4.4' and in the…
Yariv
  • 1,212
  • 10
  • 21
0
votes
1 answer

Different environments not working in NestJS

I would like to create a new environment for testing my app. I have a .env file and .env.test file. This is my app.module.ts file: @Module({ imports: [ ConfigModule.forRoot({ envFilePath: !process.env.NODE_ENV ? '.env' :…
Krneki123
  • 67
  • 5
0
votes
1 answer

Dynamic MonoDB connection for child modules - NestJS

I'm trying to implement Multi-tenancy application which will have the collection of org details, and the org data will be stored in different databases. Like, When someone do the API call, I'll be adding x-org-id header which will send the org ID…
rakcode
  • 2,256
  • 4
  • 19
  • 44
0
votes
1 answer

Using ConfigService in Unit Test - NestJS

I have a Kafka ProducerService which looks like this: @Injectable() export class ProducerService implements OnModuleInit, OnApplicationShutdown { private logger = new Logger(ProducerService.name); public readonly topic: string; private…
0
votes
1 answer

Adding an ElasticSearch connection to app.module on Nestjs

I'm trying to create a connection with ElasticSearch on my app.module.ts. My project folder looks like: src |database |- elasticsearch-database.module.ts |- es.services.ts |services |- products |-products.controller.ts …
PedroSG
  • 466
  • 2
  • 9
  • 38
0
votes
2 answers

A clean way to check for query parameter in NestJS

I have a nestjs project that is mostly in RESTful structure. Everything works fine, but my concern is that some of the routes check for the presence of some query parameters to fetch data. for instance @Get('/some-resources') async getSomeResource( …
Fynix
  • 39
  • 2
  • 8
0
votes
1 answer

Dynamic ConfigModule cannot Inject in custom JwtModule

I created my Dynamic configModule to extract environment variables from a different path. It extracts from an yml file. Everything works properly if a add in some module. Here is my ConfigModule: import { DynamicModule } from…
DustInTheSilence
  • 575
  • 1
  • 7
  • 15
0
votes
2 answers

How to implement NestJs Configuration Files, .env (DOTENV), TypeOrm Database Configuration, AND Migrations

I've been trying to get my TypeOrm Config to work nicely with Migrations and .env without needing to specify it in two places. The struggle is this - My migration script needs to read an immediately returned object - { type: 'postgres', host:…
Jay
  • 566
  • 6
  • 18
0
votes
1 answer

Nestjs [Typeorm] Unable to connect to the database, connect ETIMEDOUT

I have a problem with the typeorm, it doesn't want to connect to my database, I have another project in exactly the same configuration pattern, and it connects normally to the database. I believe it is something with regard to the environment…