hold env config like: ip, port, db, ....
config/
dev.ts
prod.ts
test.ts
I have multi modules in project, should I create a shared module to hold env config?
If I understand correctly, maybe this can help https://www.npmjs.com/package/config
@janckerchen Im handling this by this example: https://github.com/cojack/ts-config
I'm using https://github.com/mozilla/node-convict
Additionally, you can do it in more nest-way, using custom providers. Example:
provide: ConfigService,
useClass: process.env.NODE_ENV === 'development'
? DevelopmentConfigService
: ProductionConfigService
where ConfigService
is an abstract
class and both DevelopmentConfigService
and ProductionConfigService
extends ConfigService
.
thx @kamilmysliwiec . I found there are three ways to spread config to multi modules.
I switched from rails, I expect proper nest-way to manage config.
Are there plans to build @kamilmysliwiec recommendation into the framework?
And what about https://github.com/nestjs-community/nestjs-config ?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Are there plans to build @kamilmysliwiec recommendation into the framework?