I'm moving a node.js/express application to nest.js.
The config of the app is handled with node-config (default.js
and host specific js-files).
I have copied the config files to the new application folder, imported the config module, and used some config.get()
calls. The old application works perfect but with nest.js I get only the settings from default.js. Does anybody know why node-config is not working with nest.js?
// main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as config from "config";
async function bootstrap() {
const port = Number.parseInt( config.get( "application.port" ), 10 );
console.log( `Server listening on port: ${port}` );
const app = await NestFactory.create( AppModule );
await app.listen( port );
}
bootstrap();
config.get() returns always the value from default.js