Questions about a ConfigService in documentation: https://docs.nestjs.com/techniques/configuration#service
See the class definition there:
export class ConfigService { /* ... */ }
Why there is no @Injectable decorator? Is there any reason or just a mistake? Has @Injectable decorator any impact on a fact the module that provides ConfigService
might be @Global?
there is no @Injectable decorator because this class is used as a custom provider. See follow the usage:
{
provide: ConfigService,
useValue: new ConfigService(`${process.env.NODE_ENV}.env`),
},
In that case, your able to specify the token and the value that you want to use, here the configService is instantiate manually and not by the DI system.
When you use the @Injectable decorator you tell to nestjs that this class as to be instantiate by the framework.
I hope this will help you to understand.